How to place unicode characters in my Antlr grammar?

I am trying to build a grammar with the following:

NUMBER: INTEGER | FLOAT | INFINITY | PI ... INFINITY: '∞' PI: 'π'

But Antlr refuses to load the grammar.

+4
source share
1 answer

Use a Java expression representing a Unicode character:

  • 'π' = '\ u03C0'
  • '∞' = '\ u221E'

This will work until '\ uFFFF'; Java does not support five-digit Unicode.

+3
source

Source: https://habr.com/ru/post/1276424/


All Articles