[antlr-interest] digit-ended literals (was New faq entries - import/export)

Terence Parr parrt at jguru.com
Tue Oct 30 09:57:47 PST 2001


On Tuesday, October 30, 2001, at 04:30  AM, Bogdan Mitu wrote:

> ----- Original Message -----
> From: "Terence Parr" <parrt at jguru.com>
>
>> What exactly is the bug you refer to?  "if0" is specifically a literal
>> that doesn't work or is the whole literals scheme broken from your
>> perspective?
>>
>> Ter
>
> I looked more closely to what is generated, and it's not a bug, indeed, 
> but
> still is something weird. If I have a string "if" in the parser, it
> generates an entry:
> int LITERAL_if = 4
> in the interface XxxParserTokenTypes.java
>
> But if the string is "if0", the generated line is just a comment:
> // "if0" = 4
>
> I thought this is a bug, but it works, because a number is still 
> reserved
> for the token. There is still a problem, however: if I want to refer the
> tokens from outside, I can only use the number (in this example 4), and 
> this
> number is likely to change whenever I change the grammar. I don't see 
> any
> reason why literals ended with digits are treated different.
>

Isn't the "if0" in the .txt (persistence) file?  That should be how it 
communicates.

Ter


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list