Replies: 1 comment
-
Hey @ben5311,
Currently not possible, though I believe that #947 will alleviate that issue once it gets released in 1.2.0.
We didn't encounter that requirement yet, since we usually just use a
It didn't make sense to allow
Something like this: #758? Currently it's not possible, since a terminal rule needs to return a primitive. We usually follow a relatively simple pattern where we wrap terminals into respective objects. Something like:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Objective
I want to implement a simple JSON grammar using Langium.
It seems to be working for Xtext with a grammar like this:
This does not directly work in Langium.
I am getting this error for the terminal rules:
This parser rule does not create an object. Add a primitive return type or an action to the start of the rule to force object instantiation
.With some changes it does work:
While this works fine, I'd prefer the literal type to have the same interface as the "Objekt" type.
Right now I need to access
property.value.literal
, but instead I want to access it right underproperty.value
, whether it's an object or a literal.However, replacing the Literal rule with the following does not work:
Questions
null
tokens into Javascriptnull
orundefined
(Langium does not allow a terminal to return null)?Steps To Reproduce
npm install
Beta Was this translation helpful? Give feedback.
All reactions