-
I'm traversing the AST I receive from the parser, and can traverse using the generated isXYZ predicates and types. However, when I read a STRING feature, it includes the quotes, and although I can strip them off myself, I guess the correct way to do it is to use a ValueConverter. However, it has a convert methods that takes the value and a What is the correct approach? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hi @hallvard, I guess we f'd something up. The default value converter will strip the quotes if you rename the On a more general note: You don't have to retrieve the |
Beta Was this translation helpful? Give feedback.
Hi @hallvard, I guess we f'd something up. The default value converter will strip the quotes if you rename the
STRING
terminal tostring
(even though it will show a warning). The reason for that is this code:https://github.com/langium/langium/blob/fbdef5d08b059e182a86db60dc06ef46e44d35e5/packages/langium/src/parser/value-converter.ts#L32-L36
On a more general note: You don't have to retrieve the
CstNode
yourself, you can just override the protectedrunConverter
method, and bind your customValueConverter
in your services declaration.