Usage of externally defined symbols in grammar [message #1815028] |
Tue, 24 September 2019 12:03 |
Jozsef Klespitz Messages: 34 Registered: September 2019 |
Member |
|
|
Hello everyone,
I am building a language where I want to use externally defined items.
Let's say these are enumerations, classes and global variables in a different project. I want to collect these items and I want to see them in the grammar editor with syntax highlight and auto-completion (as if they were part of the original grammar).
What is the preferred method to do this?
My current best guess is to add a custom Inferrer with Xbase, but I am uncertain about the details.
Thanks for the suggestions!
[Updated on: Tue, 24 September 2019 12:03] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Usage of externally defined symbols in grammar [message #1815167 is a reply to message #1815166] |
Thu, 26 September 2019 12:27 |
|
you introduce a concept color declaration (somewhere in your or as separate dsl)
Model:
colorDecls+=ColorDeclaration+;
ColorDeclaration: "Color" name=ID
then you refer to that decl in your place
Color:
value=[ColorDeclaration|ID];
the you create a colors.mydsl
Color red
Color green
Color blue
and package that to a jar.
this jar you put on the classpath of the model project
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05343 seconds