[antlr-interest] semantic predicate problem
Lloyd Dupont
lloyd at nova-mind.com
Mon May 30 18:55:36 PDT 2005
I'm trying to resolve my problem with this ID which "could be" keyword, by doing a semantic predicate in a parser rule.
something like that:
someStruct
: something (structWithContextualKeyword)? somethingElse
structWithContextualKeyword
: A_KEYWORD
| AN_OTHER_KEYWORD
| aSpecialId
;
aSpecialID
: { isSpecialID(LT(1).getText()) } ?
t:ID { t.setType(SPECIAL_ID); }
;
but this bring me plenty of parsing time error with a stack trace pointing to aSpecialID,
so I tried something like that:
aSpecialID
: { isSpecialID(LT(1).getText()) } ?
t:ID { t.setType(SPECIAL_ID); }
|
;
but this cause the program to hang (no output, no token consume, ..)
so...
any idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050531/3f6f065b/attachment.html
More information about the antlr-interest
mailing list