[antlr-interest] probably too obvious to see it - plz help
mzukowski at yci.com
mzukowski at yci.com
Thu Jul 31 16:20:49 PDT 2003
By the way, the reason is the optional 'n' and antlr's linear approximate
lookahead.
Monty
-----Original Message-----
From: mzukowski at yci.com [mailto:mzukowski at yci.com]
Sent: Thursday, July 31, 2003 4:18 PM
To: antlr-interest at yahoogroups.com
Subject: RE: [antlr-interest] probably too obvious to see it - plz help
So if it sees "n" which rule is it supposed to choose? You need to handle
the two possibilities prefixed with 'n' in one rule.
Monty
-----Original Message-----
From: tdjastrzebski [mailto:tdjastrzebski at yahoo.com]
Sent: Thursday, July 31, 2003 4:14 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] probably too obvious to see it - plz help
I ma probably too tireed to see it. Why following two lexer rules
cause nondeterminism (k=2).
Identifier
: ('a'..'z')+
;
StringLiteral
: ('n')? '\'' (~'\'')* '\''
;
StringLiteral rule is supposed to match unicode strings like:
n'blabla'
Thanks in advance.
Tom Jastrzebski
full test grammar:
options {
language = "Java";
}
class TestParser extends Parser;
options {
k = 2;
}
expression
: (Identifier | StringLiteral) EOF
;
class TestLexer extends Lexer;
options {
k = 2;
}
Identifier
: ('a'..'z')+
;
StringLiteral
: ('n')? '\'' (~'\'')* '\''
;
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list