System.out still occurs after errClear
Transcribe Parsing Expression Grammar into a parser written in Java.
Brought to you by:
roman_redz
I have found that System.out.println
is still called in BaseParser#closeParser(...)
even after I have tried to follow the instructions for 18.7 Own diagnostic output
in the PDF manual.
My PEG looks like:
regularExpression = regExp !_ {result} ~{failure} ; regExp = branch ( "|" branch )* {} ; branch = piece* ; ...
My Semantics Class looks like:
void result() { javaRegularExpression = Right(lhs().text()); } void failure() { javaRegularExpression = Left(lhs().errMsg()); lhs().errClear(); }
However at run time, when the regex does not match I still see via System.out, At start: expected regularExpression
, which comes from closeParser
.
Is this a bug? If so I could attempt to send a patch. If not, what am I doing wrong?
Hello Adam,
Thanks for your report. Seems to be a bug, and I start looking at it.
Sorry for reacting so late, but I have been away for a while.
Best regards
Roman
On 2017-11-25 20:36, Adam Retter wrote:
Related
Patches:
#2On 2017-11-25 20:36, Adam Retter wrote:
Related
Patches:
#2This is a bug in the logic.
The reject() called after failure() cancels the effect of errClear().
Working on a solution.
(My two preceding entries result from an attemp to use e-mail; can be ignored.)
Temporary fix: modify top parsing procedure in the generated parser.
(In this case "RegularExpression".)
Replace "return accept()" by "return true" and "return reject()" by "return false".
Fixed in version 1.9.2.
Hey Roman, thanks for fixing so quickly :-)