Errors not getting reported correctly
[email protected] ("Gary") Thu, 18 Dec 2003 22:54:37 -0600
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
No matter what I do, I can't seem to coax Parse::RecDescent into reporting
errors from the right location in what I've reduced to the following code
snippet. I would expect for P::RD to report line 7 as an error in the
following example, but instead, it reports from line 2, near the start of
the parse tree, regardless of where I put the error. Any ideas?
===================================
#! /usr/local/bin/perl -w
use Parse::RecDescent;
use Data::Dumper;
my $parser = new Parse::RecDescent('
<autotree>
prog : item eof
| <error>
item : /\w+/ list(?)
list : "(" item(s) ")"
eof : /^\Z/
');
my $test = '
a(
b
c
d(
1
2
!!wrong!!
4
)
e
)
';
print Dumper $parser->prog($test);