Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Parse::RecDescent eats large part of grammar, thinking it to be implicit subrule

by castaway (Parson)
on Jan 22, 2003 at 10:00 UTC ( #228981=note: print w/replies, xml ) Need Help??


in reply to Parse::RecDescent eats large part of grammar, thinking it to be implicit subrule

I tink that P::RD is getting confused with your very first line:
command: ( oops /\s+/ word { "(oops '$item[2])" }
I also had some problems doing "( rule | rule2 | rule3 ) rule4", I'd suggest trying splitting it up:
command: subcommand ...!/\S/ subcommand: oops {action} | np {action} | ..
BTW, you don't need to explicitly say that commands/words has any number of spaces between them, the parser assumes that anyway. (At least, mine did :)

C.

Replies are listed 'Best First'.
Re: Re: Parse::RecDescent eats large part of grammar, thinking it to be implicit subrule
by premchai21 (Curate) on Jan 23, 2003 at 01:24 UTC

    In response to making the subrule explicit: I'll try that, thank you.

    In response to your other suggestion: yes, whitespace will be skipped, but I want to force it to only match when there is at least one space in between. However, me being stupid, I did not notice that the default is not + but *; using + instead would probably do what I want.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2020-08-09 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (55 votes). Check out past polls.

    Notices?