Subject: | Errors in subrule definitions are verbosely ignored |
Date: | Tue, 6 Apr 2010 23:56:50 +0400 |
To: | bug-Parse-RecDescent [...] rt.cpan.org |
From: | Evgeniy Zhemchugov <jini.zh [...] gmail.com> |
Parse::RecDescent version: Parse-RecDescent-1.965001
Perl version: v5.10.1 (*) built for x86_64-linux
Consider the following code defining an incorrect rule:
use Parse::RecDescent;
Parse::RecDescent->new('a: (.)') || die 'bad grammar';
Its actual output is:
ERROR (line 1): Untranslatable item encountered: "."
(Hint: Set $::RD_HINT (or -RD_HINT if you're using "perl -s")
for hints on fixing these problems.)
whereas expected output is:
ERROR (line 1): Untranslatable item encountered: "."
(Hint: Set $::RD_HINT (or -RD_HINT if you're using "perl -s")
for hints on fixing these problems.)
bad grammar at -e line 1.
The _generate function is supposed to return undef in case of error
($ERRORS != 0). However, in case of implicit rule the function is
called recursively and the result of inner invocation is ignored, so
the outer instance sees $ERROR == 0 and thinks that grammar is fine.
The obvious fix is in the attachement.
Message body is not shown because sender requested not to inline it.