[antlr-interest] Syntactic predicate in lexer rule
Terence Parr
parrt at cs.usfca.edu
Mon Jan 2 10:30:10 PST 2006
On Jan 2, 2006, at 10:25 AM, Terence Parr wrote:
> On Jan 1, 2006, at 7:01 PM, Martin Traverso wrote:
>> FLOAT: (DIGITS '.' DIGITS) => DIGITS '.' DIGITS;
>
> An alt with a single pred makes no sense, I'm afraid. Predicates
> indicate which of 2+ alts to match.
Actually, I take this back. There is a quirk i just realized. Syn
preds are converted to sem preds (at least for now) for
implementation, hence, they will be hoisted like any other
predicate. The (DIGITS '.' DIGITS) is converted to a boolean test
and hoisted into the artificial Tokens rule and that might work.
I suggest looking at the DFA for Tokens rule to see how it
looks...should be an option in antlrworks for that.
Ter
More information about the antlr-interest
mailing list