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.