[antlr-interest] Quoted Strings in ANTLR 3.0.1 and 3.1.1
Fromm, Stefan
Fromm at dresden-informatik.de
Wed Oct 22 22:43:43 PDT 2008
Hello,
I have written a grammar for a subset of SQL which has to accept quoted
SQL strings. With ANTLR 3.0.1 the grammar is working. When porting to
ANTLR 3.1.1 the grammar is not working anymore. I have extracted a
simple test grammar:
grammar QuotedStringTest;
QUOTED_STRING
: '\'' ( '\'\'' | ~('\'') )* '\'';
NUMBER
: ('+' | '-')? '0'..'9'+ ('.' '0'..'9'+)?;
value_expr
: QUOTED_STRING | NUMBER;
With ANTLR 3.0.1 these test cases work fine. In 3.1.1 I received these
results:
'''' matched
'''''' matched
'''a' matched
'''a''' matched
'''a''b' matched
'''a''b''' matched
'a''' not matched, expected to match
'a''b' matched, but with 'a''
'a''b''c' matched, but with 'a''
However the following test case works neither in 3.0.1 nor in 3.1.1:
''a'' matched, expected not to match
Does my grammar have errors or has ANTLR changed lexing/parsing strategy
since 3.0.1? Is there any hint about the last test case?
Best regards
Stefan
More information about the antlr-interest
mailing list