I have a grammar as such:
grammar Testquote;
program : (Line ';')+ ;
Line: L_S_STRING ;
L_S_STRING : '\'' (('\'' '\'') | ('\\' '\'') | ~('\''))* '\''; // Single quoted string literal
L_WS : L_BLANK+ -> skip ; // Whitespace
fragment L_BLANK : (' ' | '\t' | '\r' | '\n') ;
This grammar--and the L_S_STRING
in particular--seems working fine with vanilla inputs like:
'ab';
'cd';
However, it fails with this input:
'yyyy-MM-dd\\'T\\'HH:mm:ss\\'Z\\'';
'cd';
Yet works when I changed the first line to either
'yyyy-MM-dd\\'T\\'HH:mm:ss\\'Z''';
or
'yyyy-MM-dd\\'T\\'HH:mm:ss\\'Z\\' '
;
I sorta can see why the parser may choose this failed route. But is there some way I can tell it to choose differently?