I've got a lexer rule that should be gobbling everything after the
double quote '"' except for the last double quote - I basically stole
the rule from a post from Jim Idle
(http://www.antlr.org/pipermail/antlr-interest/2010-March/038051.html).
I've also tried other variations on the same rule, and I'm a bit
confused as it seems the {greedy=false;} option is being ignored.
Any help is appreciated
-----------------------------------------------
INPUT: @"(FOO="")"
-----------------------------------------------
lexer grammar Lexer
options
{
language=CSharp3;
TokenLabelType=CommonToken;
}
DQUOTE : '"';
STRING_LITERAL
: DQUOTE (options { greedy = false; }
: (
(
{input.LA(1) == '"' && input.LA(2) == '"'}? DQUOTE DQUOTE
| ~DQUOTE
)*
)
)
DQUOTE
;
-----------------------------------------------
LEXER TRACE (excerpt):
enter STRING_LITERAL " line=1:7
enter DQUOTE " line=1:7
exit DQUOTE ) line=1:8
enter DQUOTE ? line=1:9
exit DQUOTE ? line=1:9
exit STRING_LITERAL ? line=1:9
line 1:10 mismatched character '<EOF>' expecting '"'
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.