tags:

views:

54

answers:

1
I get a mismatched set exception when I try to parse "abc" (the quote marks are part of the input) Here is the (simplified) grammar - pretty much verbatim from the Java.g example and basically the same from other example grammars. Is there some bug in the latest version? Using 3.2 in the context of eclipse. Thanks in advance. grammar String; options { language = C; } rule: literal EOF; literal : CHARLITERAL | STRINGLITERAL ; CHARLITERAL : '\'' ( EscapeSequence | ~( '\\'' | '\\\\' | '\\r' | '\\n' ) ) '\'' ; STRINGLITERAL : '"' ( EscapeSequence | ~( '\\\\' | '"' | '\\r' | '\\n' ) )* '"' ; fragment EscapeSequence : '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\"' | '\\'' | '\\\\' | ('0'..'3') ('0'..'7') ('0'..'7') | ('0'..'7') ('0'..'7') | ('0'..'7') ) ;
A: 

I'm confused by these last edits, but the problem is with the interpreter and is a known problem. Reported in 09.

If the code is generated for the grammar, it works like a charm.

It seems hard to believe that this bug has gone unanswered so long given it's frequency of occurrence.

Fred Finkle
@Fred, ok, I rolled back to revision 4 (your own).
Bart Kiers