-
Hello,I encounter with a problem:In the syntax definition, a VarDef exists as a sub-part of VarDecl, containing a terminator name=ID. I hope to implement [VarDef:ID] through cross-reference. In practice, because the scope of VarDef is within VarDecl, other external statements cannot detect the ID on VarDef. Is there a way to make the scope of VarDef higher, or to make VarDecl reflect the ID of VarDef? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
hi can you give a grammar snippet/example model. maybe simply implementing https://langium.org/docs/recipes/scoping/class-member/ or a variance of it is what you are looking for |
Beta Was this translation helpful? Give feedback.
-
Hey @cyc24w42, In addition to Christian's comment about member scoping, you should probably take a look at the qualified name scoping guide. It shows how to expose elements to outer scopes in the scope conputation phase. To explain your issue in short: The default scope computation will make your |
Beta Was this translation helpful? Give feedback.
yes it does. you simply collect the vardefs and put them into scope.