I know it is possible to switch between the default and hidden token channels in an ANTLR grammar, but lets say I want a third channel. How can I define a new token channel in the gramar? For instance, lets say I want a channel named ALTERNATIVE.
Share
They’re just
final int‘s in theTokenclass, so you could simply introduce an extra
intin your lexer like this:A related Q&A: How do I get an Antlr Parser rule to read from both default AND hidden channel