Попробуйте обернуть многосимвольный литерал {
и }
и использовать набор символов стиля v4 [...]
:
Character : [\u0000-\u{10FFF}];
Из https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md#lexer-rule-elements:
[...] Match one of the characters specified in the character set. Interpret
x-y
as the set of characters between rangex
andy
, inclusively. The following escaped characters are interpreted as single special characters:\n
,\r
,\b
,\t
,\f
,\uXXXX
, and\u{XXXXXX}
. To get]
,\
, or-
you must escape them with\
.
Не всегда нужно бежать
-
. Только их надо убегать не на границы. Например, следующее определение прекрасно работает:[+-]
.