Hi,
I need some help with regard to cross-referencing. I have 3 separate DSL's - 1) Entity DSL for entities and attributes, 2) Function DSL for functions with parameters, and 3) Consumer DSL that cross-references Entities, attribites and the functions from the respective DSL's. Everything works fine - Entities and attributes (specific to entities) are available on content assist. For function, content assist shows the names. I need the function name with parameters, for example (some_function(param1, param2...)).
I have tried something similar to the NameProvider in XText arithmetic example. In the EntityConsumerSwitch.caseFunctionRef(), I get null value for the Function reference - fReference.getFRef(). Any idea how this could be fixed ? My functions are defined in a separate file.
Also, I also saw the following error - Cyclic resolution of lazy links : AttributeRef.aRef->EntityRef.type->AttributeRef.aRef.
Entity DSL
generate entityDSL "http://www.example.org/xtext/entity/dsl/EntityDSL"
Model:
'namespace' name=QName
entities+=Entity*
;
Entity:
'entity' name=ID '{'
attributes+=Attribute*
'}'
;
Attribute:
'attribute' name=ID
;
QName:
ID ('.' ID)*
;
Function DSL
generate functionDSL "http://www.example.org/xtext/function/dsl/FunctionDSL"
Model:
functions+=Function*;
Function:
'func' name=ID '('parameters+=Parameter (',' parameters+=Parameter)* ')'
;
Parameter:
name=ID ':' type=Type
;
Type:
'string'
;
Consumer DSL
generate entityConsumer "http://www.example.org/xtext/entityconsumer/dsl/EntityConsumer"
import "http://www.example.org/xtext/entity/dsl/EntityDSL" as entity
import "http://www.example.org/xtext/function/dsl/FunctionDSL" as function
Model:
eRef+=EntityRef*
;
EntityRef:
'entity-ref' type=[entity::Entity|QName] '{'
afRef+=AFReference (';' afRef+=AFReference)*
'}'
;
AFReference:
aRef=AttributeRef '::' fRef=FunctionRef
;
AttributeRef:
aRef=[entity::Attribute]
;
FunctionRef:
fRef=[function::Function]
;
QName:
ID ('.' ID)*
;
Thanks in advance.