How can I write this grammar expression for ANTLR4 input?
Originally expression:
<int_literal> = 0|(1 -9){0 -9}
<char_literal> = ’( ESC |~( ’|\| LF | CR )) ’
<string_literal> = "{ ESC |~("|\| LF | CR )}"
I tried the following expression:
int_literal : '0' | ('1'..'9')('0'..'9')*;
char_literal : '('ESC' | '~'('\'|'''|'LF'|'CR'))';
But it returned:
syntax error: '\' came as a complete surprise to me
syntax error: mismatched input ')' expecting SEMI while matching a rule
unterminated string literal