2

I'm trying to use a JavaScript grammar with antlr4 (copyright 2008 by Chris Lambrou, retrieved from http://www.antlr3.org/grammar/1206736738015/JavaScript.g). The script contains many instances of "LT!*", which I understand as a regex expression meaning zero or more line terminators and don't include the tokens in the generated AST (from answer to stackoverflow question ANTLR 3, what does LT!* mean?).

antlr4 throws a syntax error for each instance of "LT!*" so I assume the most recent version doesn't handle that construct. What can be used to replace "LT!*" that will work in antlr4?

[edit] Note that the syntax error is on the "!"

Community
  • 1
  • 1
CarlH
  • 568
  • 5
  • 16

1 Answers1

1

ANTLR 4 does not produce AST. Therefore, the ! (and ->) inside parser rules is not allowed.

See: How can I build an AST using ANTLR4?

Community
  • 1
  • 1
Bart Kiers
  • 166,582
  • 36
  • 299
  • 288
  • Thanks. I did a bit of looking around and couldn't quite find the answer - I was avoiding diving into the real documentation, but that appears to be the best way to go - had hoped antlr would be more of a wysiwyg tool, but after some more investigation I think it will be a worthwhile investment. There goes another weekend ... and hopefully not another "25 years". -Carl – CarlH Mar 07 '14 at 17:20