[antlr-interest] character literal bugs in 2007-12-27.12

J Chapman Flack jflack at math.purdue.edu
Fri Dec 28 12:44:57 PST 2007


My lexer rule:

WS : ( ' '
      | '\f'
      | '\n'
      | '\r'
      | '\t'
      | '\013' // \v
      )
      { $channel = HIDDEN; }
    ;

produces in Java:

             ...
             case '\u0000':
                 {
                 alt1=6;
                 }
                 break;
             ...
             case 6 :
                 ... match("\013"); ...

That is, the \013 literal is passed correctly to match(),
but in the *decision* it seems to have been treated as a
\0 escape followed by a 1 and a 3. Also, the comments generated
into the code refer to '\\013' which would be yet another
different string.

-Chap


More information about the antlr-interest mailing list