Reference using a multivariable definition #829
|
Hello, Could be possible to reference an object in the following oversimplified situation? Line 1 defines three variables (x, y, z) of type "tello" ExampleGrammarIn this situation based on my current grammar definition I get an error saying that 'x' cannot be found. Could be possible to reference a variable that was defined using the current syntax? Best regards, |
Replies: 1 comment 1 reply
|
Hey @rhumbertgz, Langium is by default using a very simple lexical scoping mechanism (i.e. you can reference everything that is declared locally or in a parent of the current AST node). Since the
You'll need to modify your grammar slightly, but that shouldn't be too much of an issue. Most of the work will be in correctly computing the local scope for the |
Hey @rhumbertgz,
Langium is by default using a very simple lexical scoping mechanism (i.e. you can reference everything that is declared locally or in a parent of the current AST node). Since the
LetandGonodes probably live in different hierarchies, they can't see each other directly through the lexical scoping. So to fix this, you'll need to do the following:Letrule slightly: