This is my XML parser grammar:
attribute : Name '=' STRING ;
and the lexer:
STRING : '"' ~[<"]* '"'
| '\'' ~[<']* '\''
;
This works, however when I retrieve the STRING bit in my C# code with :
context.STRING().ToString();
I get the text wrapped in quotation marks like : "hello", instead of hello. So I try to change the parser grammar to :
attribute : Name '=' '"' STRING ;
or
attribute : Name '="' STRING ;
and I get the error : "cannot create implicit token for string literal in non-combined grammar"
I'm confused as to why the "=" is allowed in the parser grammar, but not quotation marks, and how to change the parser to retrieve the text without quotation marks. Also, it seems that the lexer already takes care of getting rid of quotation marks so I don't understand why I still get them when parsing.
EQ: '=';
in your lexer grammar, right? – sepp2k