Handling scope for single and double quote strings in ANTLR4
问题 I am working with ANTLR4 and in the process of writing grammar to handle single and double quoted strings. I am trying to use Lexer modes to scope the strings but that is not working out for me, my grammar is listed below. Is this the right way or how can I properly parse these as tokens instead of parser rules with context. Any insight? An example: 'single quote that contain "a double quote 'that has another single quote'"' Lexer Grammar lexer grammar StringLexer; fragment SQUOTE: '\'';