Disambiguate between reference and ValidID [message #1731570] |
Fri, 06 May 2016 18:05  |
Eclipse User |
|
|
|
I have a point in my grammar where I would like to handle either a ValidID or a cross-reference.
However, this creates an ambiguity, as the cross-reference also relies on the RULE_ID.
Is there a good solution to this, other than inserting some kind of special token?
Here's a simple example grammar to illustrate:
Declaration:
name=ID
;
Reference:
IDReference | DeclarationReference
;
IDReference:
idRef = ValidID ';'
;
DeclarationReference:
declRef = [Declaration] ';'
;
I could just use the ValidID rule, and then internally check if such an ID matches a known declaration. If that's the best option, can do, though it'll mean losing the inherent benefits of the cross-reference system.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05182 seconds