in reply to Re^2: My issues with Parse::RecDescent
in thread My issues with Parse::RecDescent
D:\>perl use strict; use Parse::RecDescent; my $grammar = q( START: ( number | word )+ word: /\w+/ { print "found a word\n"; } number: /\d+/ { print "found a number\n"; } ); Parse::RecDescent->new($grammar)->START("123 geo 456 bam"); __END__ ERROR (line 2): Untranslatable item encountered: "+" (Hint: Set $::RD_HINT (or -RD_HINT if you're using "pe +rl -s") for hints on fixing these problems.) Can't call method "START" on an undefined value at - line 10. D:\>perl $::RD_HINT=1; use strict; use Parse::RecDescent; my $grammar = q( START: ( number | word )+ word: /\w+/ { print "found a word\n"; } number: /\d+/ { print "found a number\n"; } ); Parse::RecDescent->new($grammar)->START("123 geo 456 bam"); __END__ ERROR (line 2): Untranslatable item encountered: "+" (Hint: Did you misspell "+" or forget to comment it ou +t?) Can't call method "START" on an undefined value at - line 11. D:\>perl $::RD_HINT=1; use strict; use Parse::RecDescent; my $grammar = q( START: ( number | word )(s) word: /\w+/ { print "found a word\n"; } number: /\d+/ { print "found a number\n"; } ); Parse::RecDescent->new($grammar)->START("123 geo 456 bam"); __END__ found a number found a word found a number found a word
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: My issues with Parse::RecDescent
by Anonymous Monk on Aug 26, 2008 at 20:17 UTC | |
|
Re^4: My issues with Parse::RecDescent
by Alien (Monk) on Aug 26, 2008 at 20:19 UTC |