[antlr-interest] duplicate int values in the token definition file

Christian chwchw at gmx.de
Fri Jan 20 03:39:09 PST 2012


Hello community,

I have a combined C# grammar and get the following error, while
executing the parser on a C# source file:
    attrs: null
    mods: null
    resource/Console.cs line 138:6 no viable alternative at input 'get'

within the following rule:
    accessor_declarations
  : attrs=attributes? {System.err.println("attrs: "+$attrs.text);}
    mods=accessor_modifier? {System.err.println("mods: "+$mods.text);}
    ( 'get' {System.err.println("get");} accessor_body
set_accessor_declaration?
    | 'set' accessor_body get_accessor_declaration?
    )
  ;

If I define 'get' as explicit token using the tokens section, the same
error for another such a literal occurs. I have looked at the token
definition file. It contains among other things the following
    T__246=246
    'get'=246

I admit that I do not know for what the T__ are defined. Can somebody
explain and tell a reason for this behavior?

Regards,
Christian


More information about the antlr-interest mailing list