1
// Parser
statement
    : DELIMITER* statementPart+ DELIMITER* (EOL { newline(); })?
    ;

// Lexer
DELIMITER
    : ';'
    ;


sql-stmt.g:85:13: rule classDef trapped:
sql-stmt.g:85:13: unexpected token: DELIMITER

Line 85 is the statement rule. I really have no idea why this fails. Please help?

This is with Antlr2 btw. Yes, yes, super old, yes, yes...

Thanks!

Steve Ebersole
  • 9,339
  • 2
  • 48
  • 46

1 Answers1

2

Been playing with Antlr4 too much :) In Antlr2 I guess tokens / rules have to be wrapped in parens to apply * or + or ...

Steve Ebersole
  • 9,339
  • 2
  • 48
  • 46
  • Haha, nice! That might also explain why I see parenthesised single tokens in v3 or even v4 grammars: these might very well have been ported from v2 grammars. – Bart Kiers May 15 '20 at 07:33
  • Thanks Bart. Even worse, I am trying to back-port some work we did using Antlr 4 to stuff using Antlr2 lol. Since you are extremely knowledgeable with Antlr, if you have time would you be willing to look at https://stackoverflow.com/questions/61821211/negated-lexer-rules-tokens? Its related to this same work. Thanks :) – Steve Ebersole May 15 '20 at 14:07
  • Not much free time ATM and I've never done much with ANTLR v2, but if your question isn't answered by Sunday, I'll see if I can get v2 running on my machine. – Bart Kiers May 15 '20 at 14:13