[antlr-interest] Stream rewrite bug in the C# target?
Johannes Luber
jaluber at gmx.de
Wed Oct 3 14:46:53 PDT 2007
Hi,
in the attached grammar I have the following rule:
rule
: DOC_COMMENT?
f=( PROTECTED
| PUBLIC
| PRIVATE
| FRAGMENT
)?
ruleName=id
'!'?
( arg=ARG_ACTION )?
( 'returns' rt=ARG_ACTION )?
throwsSpec?
optionsSpec?
ruleScopeSpec?
ruleAction*
':'
altList
';'
exceptionGroup?
-> ^( RULE $f? $ruleName altList EOR["<end-of-rule>"])
// I'm only interested in the name and the alternatives
;
As you can see I want to know, if a particular ANTLR rule is a fragment
rule. The generated code consumes the FRAGMENT token, but fails to
include it into the rewrite stream. The code snippet
// ANTLR3ToRelaxNG.g:191:17: ( $f)?
if ( stream_f.HasNext() )
{
adaptor.AddChild(root_1, stream_f.Next());
}
won't be executed as stream_f is empty. So before I dig down into the
sources, it would be nice to know if the error occurs for the Java
target, too.
Best regards,
Johannes Luber
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ANTLR3ToRelaxNG.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20071003/d2974d38/attachment.pl
More information about the antlr-interest
mailing list