Reputation:
"Choose ""A"" for All Areas." is the string and my grammar rule for string is STRING : '\"' .* '\"' ; its not going in a way I thought and stopped till "choose " . what rule can I write to accept the above input.
Upvotes: 1
Views: 203
Reputation: 170188
Something like this would do the trick:
STRING
: '"' ( ~["] | '""' )* '"'
;
Note that the rule above would also accept line breaks inside your string literal. If you don't want that, include \r\n
in the negated set:
STRING
: '"' ( ~["\r\n] | '""' )* '"'
;
Upvotes: 1