[antlr-interest] character literal bugs in 2007-12-27.12
Terence Parr
parrt at cs.usfca.edu
Mon Dec 31 12:25:09 PST 2007
zoiks! Ok, i allowed octal escapes...rather than fix, it's illegal
now ;) try:
WS : ( ' '
| '\f' {;}
| '\n'
| '\r'
| '\t'
| '\u000B' // \v
)
{ $channel = HIDDEN; }
;
Ter
On Dec 28, 2007, at 12:44 PM, J Chapman Flack wrote:
>
> 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