xtext - Which entity does a cross-reference refer? -
if have following input
test = 3; //first test = test + 3; //second   parsed grammar looks (for example)
declaration:     name=id "=" declarationcontent ;      declarationcontent:         number=int ("+" declarationcontent)?         | reference=[declaration] ("+" declarationcontent)?     ;   to declaration reference refer (looking @ second declaration in example)? or in other words reference "test" (second declaration) refer first declaration ("test = 3;") or directly ("test = test+ 3") , therefor cycle in hierarchy.  
greeting krzmbrzl
xtext link cross reference [declaration] first elemenent identified given id. in example hello + 3, cross reference behind hello resolved declaration hello in line 1. if have more 1 element same (qualified) name within same scope (container of visibility) xtext throw exception. should
- implement own scopeprovider (use generated stub in 
your.dsl.scoping.yourdslscopeprovider) resolve problem or use composed check automatically validate names.
fragment = validation.javavalidatorfragment auto-inject { composedcheck = "org.eclipse.xtext.validation.namesareuniquevalidator" }
Comments
Post a Comment