recursive error reporting
[email protected] (Robert Lemmen) Mon, 8 Nov 2010 19:01:49 +0000
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
hi folks,
I am playing around with PRD, and really like it so far. But I can quite
get my head around some details of the error reporting. consider the
following grammar:
code : fact(s?) eofile
{ $item[1] }
| <error>
eofile : /^\Z/
fact : 'fact' <commit> identifier ';'=20
{ [$item[0], $item[3]] }
| <error?><reject>
identifier : m{[A-Za-z_][A-Za-z0-9_]*}
and an input like this:
fact TFactA;
# case 1
# fact TFactB 234;
#
# case 2
# blablabla
the unmodified input parses nicely, and if I uncomment any of the two
syntax errors, it correctly rejects the input. excellent. but the error
reporting is slightly less than ideal: the error case 1 will set off the
<error> directive of the 'fact' rule (good), but *also* the <error>
directive of the 'code' rule, which is a bit odd. If I remove the error
directive of the parent rule, i'll miss errors of type 2, and if remove
the error directive of 'fact', then the error is reported in a very hard
to decipher way. Ideally i would like to have an error directive of most
rules in my syntax, but simply stop processing after I hit any of them.
Is there a way to achieve that?
I have read the FAQ and some other pages which talk about similar
problems, but please note that in this case the parser correctly rejects
the input, it just emits too many error messages
thanks robert
--=20
Robert Lemmen http://www.semistable.com=20
--MGYHOYXEY6WxJCY8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAkzYSR0ACgkQS6AOchRbaWZzPgCfWv04snAeOx7FfEt49DTdf3c2
tmoAn3yx7veAIO9qyyA8rOB50Wcy+GvX
=6TRm
-----END PGP SIGNATURE-----
--MGYHOYXEY6WxJCY8--