[antlr-interest] Compiler error, CSharp2 target: empty if condition

Johannes Luber JALuber at gmx.de
Mon Jan 12 06:20:59 PST 2009


> This is probably a known CSharp2 target compile issue, but googling the
> error message only turned up others with the same problem, no
> resolution/status.  
> 
> Questions: Will it be fixed?  best work-arounds?
> 
> 
> The compile error is: Invalid expression term ')'
> 
> Anytime I use a token in single quotes in an AST rewrite, I get the above.
>  For example, 
> 
> someRule : 'KEYWORD' 'TOKEN' ->  ^(KEYWORD TOKEN);
> 
> which produces an empty condition in a C# if statement: 
> 
>     if ( )
> 
> 
> If I remove the single quotes, the error is resolved:
> 
> someRule : KEYWORD TOKEN ->  ^(KEYWORD TOKEN);
> 
> 
> the newly gen'd code being:
> 
> if ( stream_KEYWORD.HasNext() )
> 
> Regards,
> Ben


Could you please provide a sample grammar which showcases the problem? I'm not sure how to do that from the snippets above alone.

Johannes
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


More information about the antlr-interest mailing list