[antlr-interest] newbie question, escaped characters
Rob Shields
rob at cmsnet.org.uk
Tue Mar 11 11:57:16 PDT 2008
Richard Clark wrote:
> When you added:
>
> protected WILDCARD_TERM_CHAR: '\\' ( '*' | '?' );
>
> did you remove the * and ? from ESCAPED_TERM_CHAR?
>
> ...Richard
Yes I did. So the whole thing looks like this:
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.
Rob
More information about the antlr-interest
mailing list