[antlr-interest] Gated Semantic Predicates in v4
Edgar Espina
espina.edgar at gmail.com
Thu Oct 11 11:03:52 PDT 2012
Hi,
Is there a way to match dynamic tokens in v4 and provide? (where token
usually has more than one character)
This is what I did in v3:
@lexer:members {
private String open = "{{"; // This could change at any time
private String close = "}}"; // This could change at any time
}
OPEN:
{ahead(open)}=> {match(open);}
CLOSE:
{ahead(close)}=> {match(close);}
...
TEXT:
{!ahead(open)} => {consume until we find "open"}
The open and close tokens might change at runtime, that is why there is
call to: *match.* There is also a custom rule for TEXT which basically eat
everysingle char/token until it find the open token.
My questions are:
1. How can I match dynamic tokens in v4?
2. How can I provide a match function (like TEXT) in v4?
Thanks in advance
--
edgar
More information about the antlr-interest
mailing list