hak0983 has asked for the wisdom of the Perl Monks concerning the following question:
my $mw = new MainWindow; my $mw2 = $mw->Text()->pack(); my $mw3 = $mw->Button(-text=>"Check brackets", -command => [ \&parser, $mw2 ] )->pack(); MainLoop; sub parser { my $txt = shift; my $grammar = q { startrule: print open text end print: "print" open: "'" text: /([^']*)/ end: "'" }; my $parser = Parse::RecDescent->new($grammar); if ( defined( $parser->startrule( $txt->get( "1.0", "end" )))) { print "NO ERROR\n"; } else { print "TEXT COULD NOT BE PARSED\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multiple occurences when using Parse::RecDescent
by gjb (Vicar) on Mar 29, 2005 at 14:37 UTC | |
by graff (Chancellor) on Mar 30, 2005 at 09:45 UTC | |
|
Re: multiple occurences when using Parse::RecDescent
by thekestrel (Friar) on Mar 29, 2005 at 14:42 UTC | |
by Roy Johnson (Monsignor) on Mar 29, 2005 at 14:54 UTC | |
|
Re: multiple occurences when using Parse::RecDescent
by tlm (Prior) on Mar 29, 2005 at 14:31 UTC | |
|
Re: multiple occurences when using Parse::RecDescent
by graff (Chancellor) on Mar 30, 2005 at 09:27 UTC |