[antlr-interest] Bug in generation code
Johannes Luber
jaluber at gmx.de
Wed Oct 10 08:52:54 PDT 2007
Hi,
The attachment has an unmodified ANTLR grammar, which exposes a bug. The
"rule" rule goes as follows:
rule
scope {
String name;
}
: DOC_COMMENT?
( modifier=('protected'|'public'|'private'|'fragment') )?
id {$rule::name = $id.text;}
'!'?
( arg=ARG_ACTION )?
( 'returns' rt=ARG_ACTION )?
throwsSpec? optionsSpec? ruleScopeSpec? ruleAction*
':' altList ';'
exceptionGroup?
-> ^( RULE id {modifier!=null?adaptor.create(modifier):null}
^(ARG $arg)? ^(RET $rt)?
optionsSpec? ruleScopeSpec? ruleAction*
altList
exceptionGroup?
EOR["EOR"]
)
;
The problem is with this line:
( modifier=('protected'|'public'|'private'|'fragment') )?
While the strings are recognized correctly, they aren't set as value to
modifier. In other words, 'fragment' is simply swallowed. I suppose this
is a problem with Java.stg. Or is the source somewhere else?
Best regards,
Johannes Luber
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ANTLRv3_1.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20071010/cbcf4888/attachment.pl
More information about the antlr-interest
mailing list