/usr/share/doc/libparse-recdescent-perl/examples/demo_scoredsep.pl is in libparse-recdescent-perl 1.967013+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/usr/bin/perl -ws
use Parse::RecDescent;
$RD_WARN = undef;
my $parse = Parse::RecDescent->new(<<'EOGRAMMAR');
line: seplist[sep=>','] <score: @{$item[1]}>
| seplist[sep=>':'] <score: @{$item[1]}>
| seplist[sep=>" "] <score: @{$item[1]}>
seplist: <skip:""> <leftop: /[^$arg{sep}]*/ "$arg{sep}" /[^$arg{sep}]*/>
EOGRAMMAR
while (<DATA>)
{
chomp;
my $res = $parse->line($_);
print '[', join('][', @$res), "]\n";
}
__DATA__
c,o,m,m,a,s,e,p,a,r,a,t,e,d
c:o:l:o:n:s:e:p:a:r:a:t:e:d
s p a c e s e p a r a t e d
m u:l t i,s:ep ar:a,ted
m u:l,t i,s:ep ar:a,ted
m:u:l,t i,s:ep ar:a,ted
|