Negative Look-ahead problem

2004-03-31 Thread PerlDiscuss - Perl Newsgroups and mailing lists
reserved_word: 'AND' | 'OR' WORD: ...!reserved_word /[a-z0-9]+/i Using the above grammar, rule WORD fails to match any token that start with a reserved word (e.g. Andy). That is not what I expected since in 'demo_Cgrammar.pl', we have: IDENTIFIER: ...!reserved_word /[a-z]\w*/i I

Perhaps a FAQ: How to shortcut an alternation if one already commited subrule fails

2004-03-31 Thread Karl Gaissmaier
Hi P::RD lovers, is there a general advice to shortcut an alternation in a rule if one already commited subrule fails: Example: ENTITY : ( COMMENT | OPTION | DECLARATION | SCOPE )(s) COMMENT : '#' commit m/.*/ | error? reject OPTION : IDENT '=' commit VALUE {

Re: Negative Look-ahead problem

2004-03-31 Thread Karl Gaissmaier
Andras Karacsony schrieb: Hello Karl! No, because the C grammar example doesn't tweak the skip pattern either. (I made my program work by 'preprocessing' the target text. $_ = lc ; s/\b(and|or)\b/\U$1/g; my $tree = $parser-start($_); and getting rid of the 'i'