Adrian
Adrian

Reputation: 193

ANTLR4 - multiple code blocks in lexer rule

In ANTLR v3 there was possible to add multi code blocks in one lexer rule, but in version 4 this is not allowed. What is the best way to replace this ?

TAG
:    '{' (~('}'))* '}'
     { setText(getText().substring(1, getText().length()-1)); }
|    '{!{' (options {greedy=false;} : .)* '}!}'
     { setText(getText().substring(3, getText().length()-3)); }     
;

Upvotes: 0

Views: 210

Answers (1)

Sam Harwell
Sam Harwell

Reputation: 100059

This functionality is [supposed to be] available starting with ANTLR 4.2.1. If it is not working, you should file an issue for the project.

Upvotes: 1

Related Questions