Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Parse::RecDescent and Dynamically Matched Subrule Repetition

by ikegami (Pope)
on Jan 11, 2006 at 17:42 UTC ( #522510=note: print w/replies, xml ) Need Help??


in reply to Re: Parse::RecDescent and Dynamically Matched Subrule Repetition
in thread Parse::RecDescent and Dynamically Matched Subrule Repetition

And I also changed /\S+/ to /\S+(?!\S)/ to make sure each elem was a maximum-length word.

Useless. P::RD will not backtrack through /.../. They always match as much as possible.

For example,

use Data::Dumper qw( Dumper ); use Parse::RecDescent (); my $p = Parse::RecDescent->new(<<'__END_OF_GRAMMAR__'); parse : /a*/ /a/ /\Z/ { [ $item[1], $item[2] ] } __END_OF_GRAMMAR__ print(Dumper($p->parse('aaaaa')));

outputs

$VAR1 = undef;

I almost said "The \b in /\d+\b/ is also useless.", but it turns "2foo bar" into an error.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522510]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2020-10-31 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (291 votes). Check out past polls.

    Notices?