Aftershock
Aftershock

Reputation: 5351

What happened to options in rules in ANTLR 4?

This does not compile in ANTLR 4:

Number options { backtrack=true; }
  : (IntegerLiteral Range)=> IntegerLiteral { $type = IntegerLiteral; }
  | (FloatLiteral)=> FloatLiteral { $type = FloatLiteral; }
  | IntegerLiteral { $type = IntegerLiteral; }
  ;

because of backtrace= true... What happened to it?

WHat should I use in ANTLR 4 instread of it?

Upvotes: 4

Views: 1708

Answers (1)

Bart Kiers
Bart Kiers

Reputation: 170308

At the moment, there are no rule-level options in ANTLR v4. Note that backtrack=true is no longer needed since the new parsing algorithm has no need for backtracking. Also note that in ANTLR v3, backtrack=true was not valid inside lexer rules, only parser rules.

Upvotes: 5

Related Questions