Question

I'm trying to build a grammar with the following:

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

But Antlr refuses to load the grammar.

Was it helpful?

Solution

Use the Java expression representing the Unicode character:

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

That will work up to '\uFFFF'; Java doesn't support five-digit Unicode.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top