[antlr-interest] Rule Arguments and Automatically Generated Syntactic Predicates
Randall R Schulz
rschulz at sonic.net
Wed Jul 25 09:04:57 PDT 2007
Hello again,
Is there nothing to be said about this apparent problem? At least an
explanation of why I should not have tried what I did?
RRS
On Tuesday 24 July 2007 08:07, Randall R Schulz wrote:
> Hi,
>
> I have a rule (the accept state for this particular tree grammar)
> with an argument:
>
> clifUnit [ String unitName ]
> returns [ CLPhrase cf ]
> @init {
> fAcceptor.startUnit(unitName);
> }
>
> : ( text[unitName]
>
> {
> $cf = $text.t;
> fAcceptor.acceptText($text.t);
> }
>
> | ...
>
> This grammar is generated with backtrack and memoize both enabled.
> When I generate a Java tree parser from this grammar, this method is
> produced:
>
> // $ANTLR start synpred1
> public final void synpred1_fragment() throws RecognitionException {
> // CLIFBuilder.g:647:6: ( text[unitName] )
> // CLIFBuilder.g:647:6: text[unitName]
> {
> pushFollow(FOLLOW_text_in_synpred1108);
> text(unitName);
> _fsp--;
> if (failed) return ;
>
> }
> }
> // $ANTLR end synpred1
>
>
> The problem is, the unitName argument is not propagated to the formal
> or actual parameters of this method.
>
>
> Is this a bug or a known limitation?
>
>
> Randall Schulz
More information about the antlr-interest
mailing list