use Parse::RecDescent; $RD_HINT++; $RD_WARN++; #$RD_TRACE++; my $grammar = q{ Start: Expression(s) /\Z/ Expression: LineNum Print | LineNum Goto | <error> Print: /print/i /\"/ /[\s\w]+/ /\"/ { print "$item[3]\n"; } Goto: /goto/i LineNum { print "Seen a goto line $item[2]\n"; # How do I seek back to line $item[2] of # the input? } LineNum: /\d+/ }; my $parser = new Parse::RecDescent($grammar); undef $/; my $text = <>; $parser->Start($text);
In reply to Goto with Parse::RecDescent by bent
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |