General Xtext question [message #1850960] |
Wed, 23 March 2022 13:50  |
Gaël DENIAU Messages: 4 Registered: March 2022 |
Junior Member |
|
|
Hello,
I am trying to understand how to use Xtext, not the grammar part but rather how to reuse the model.
Right now I have the grammar (file .xtext) but I cannot wrap my head around on how to use it outside the in-built editor of Xtext.
Let's say I start a new project (general purpose) on Eclipse, how do I add the model into Eclipse so that I can have the syntax highlight/autocompletion in a new file?
For example purpose, let's say I defined 'real' and 'complex' as keyword into the model. I wish to start a new project on Eclipse and be able to write in a
new blank file:
real rValue = 1.2;
complex cValue = 1.5 + 2.1i;
Then, the file will be sent through a compiler outside Eclipse.
Being a complete beginner on Eclipse, the Xtext documentation is rather obscure and I keep circling on the same topic without making any progress. Plus, I am not even sure Xtext is the right tool to do that.
Kind regards,
Edit: I am interessted in a number of features of Xtext, not just the highlighting of keywords
[Updated on: Wed, 23 March 2022 14:30] Report message to a moderator
|
|
|
Re: General Xtext question [message #1850964 is a reply to message #1850960] |
Wed, 23 March 2022 15:23   |
|
It is perfectly suited for that, but it will require for you to learn a bit. Xtext produces an Eclipse Plugin (when you did not disable that in the wizard).
The main thing is now: The plugin must be _installed_ into an Eclipse instance to become active. During development this is done by starting a so-called "Runtime Eclipse Instance". Xtext generates a so-called "Launch Configuration" for you. Then a 2nd instance of Eclipse starts up with your editor deployed.
When you later want to use this out of development you need a "p2 repository" from which you can install the plugin. This is also produced automatically with the default configuration.
For the beginning, Xtext makes this non-trivial topic very easy. However, it is really recommended to learn more about Eclipse Plugin Development, which is a more general topic, to understand this more. There are good books and blogs about this.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02268 seconds