[antlr-interest] Character literals in ANTLR 3?

Johannes Luber jaluber at gmx.de
Mon Aug 27 03:04:41 PDT 2007


Mitsu Hadeishi wrote:
> Hi,
> 
> I hope this is the right list to post this question.  I've just been
> attempting to convert a grammar from ANTLR 2 to ANTLR 3 --- I am an
> ANTLR newbie, however, so forgive me if this is a stupid  question ---
> but I am trying to convert the following from a lexer rule:
> 
>  '\177'..'\377'
> 
> ANTLR 3 doesn't recognize that syntax for string literals.  I searched
> the wiki and the ANTLR 3 documentation page and did not see any mention
> of the exact definition of the escape sequences that ANTLR 3 recognizes
> (for octal character constants in particular).  What is the ANTLR 3
> equivalent of the above?
> 
> Mitsu
> 

I don't believe that I have seen the octal notation in the TDAR, but you
can use the Unicode notation instead: '\u007f'..'\u00FF'.

Best regards,
Johannes Luber


More information about the antlr-interest mailing list