in reply to Parse::Recdescent rule problem
This should also allow you to have multiple print statements per line as long as they are separated by a ';'.my $grammar = q{ # --- Tokens --- EOF : /^\Z/ IDENTIFIER : /[A-Za-z]\w*/ QUOTE : '\'' # --- Rules --- parse : stmt(s?) EOF { $item[1] } stmt : print ';' { $item[1] } | <error> print : 'print' QUOTE IDENTIFIER QUOTE { $item[2] } }
|
|---|