[antlr-interest] Lexical k=3
John Green
greenj at ix.netcom.com
Thu Apr 3 11:18:32 PST 2003
This one looks like it should be easy, but I can't figure it out, and
because of the larger context of my lexer, I haven't come up with a good
workaround. Any pointers from this good mailing list?
For k==2:'~' I don't think that it should be trying to enter *either* of
the two rules.
-----
C:\work\antlr>java -cp /progfile/antlr antlr.Tool test.g
ANTLR Parser Generator Version 2.7.1+ (RK devel version) 1989-2000
jGuru.com
warning: lexical nondeterminism between rules TEST_ONE and TEST_TWO upon
test.g:0: k==1:'~'
test.g:0: k==2:'~'
test.g:0: k==3:<end-of-token>,'~'
-----
-----
// test.g
class Test extends Lexer;
options {
k=3;
}
TEST_ONE
:
( ('~')?
( ' '
| '\t'
| '\f'
| '\n' { newline(); }
| '\r'
)
)+
;
TEST_TWO
: ( '\\'|'/'|'#'|'%'
| "~\""
| "~\'"
)
( 'a'..'z'|'_'|'0'..'9'|'#'|'$'|'%'|'&'|'-'|'\\'|'/'
| "~\""
| "~\'"
)+
;
-----
Thanks,
John
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list