[antlr-interest] Dynamic token matching

Robert Gründler r.gruendler at gmail.com
Mon Jan 2 06:30:04 PST 2012


Hi,

the templating language i'm trying to create a parser for has the feature
to configure some delimiters, for example a print statements looks like
this by default:

{{  someVariable }}

and it's possible to configure the opening and closing delimiter.

Now when i look at the generated lexer, in my mT_OPEN_PRINT() rule the code
looks like this:

...

match("{{");

...

Is there a way to avoid the hardcoded "{{" in the call to match()?
something like:

..

match(this.LEFT_DELIM);

...

This way i could extend the lexer and make the delimters configurable.


regards

-robert


More information about the antlr-interest mailing list