[antlr-interest] newbie question, escaped characters

Gavin Lambert antlr at mirality.co.nz
Tue Mar 11 12:15:10 PDT 2008


At 07:57 12/03/2008, Rob Shields wrote:
 >protected TERM_CHAR: SIMPLE_TERM_CHAR | ESCAPED_TERM_CHAR |
 >WILDCARD_TERM_CHAR;
 >
 >protected SIMPLE_TERM_CHAR:  ~( ' ' | '\t' | '!' | '(' | ')' | 
':'
 >| '^' |
 >                          '[' | ']' | '\\' | '\"' | '{' | '}' | 
'~'
 >| '/' |
 >                          '\r' | '\n' );
 >
 >protected ESCAPED_TERM_CHAR:  '\\'! ( '\\' | '+'  | '-' | '!' | 
'('
 >|
 >')' | ':' | '^' |
 >                               '[' | ']' | '\"' | '{' | '}' | 
'~' |
 >'/');
 >
 >protected WILDCARD_TERM_CHAR: '\\' ( '*' | '?' );
 >
 >This gives a warning about lexical nondeterminism
 >(ESCAPED_TERM_CHAR and WILDCARD_TERM_CHAR both start with \)
 >and WILDCARD_TERM_CHAR doesn't work. If I swap around
 >ESCAPED_TERM_CHAR and WILDCARD_TERM_CHAR, then
 >ESCAPED_TERM_CHAR doesn't work.

What's the value of k?  Is it at least 2?



More information about the antlr-interest mailing list