|Re: Best practices for defining custom terminals in a dedicated grammar file [message #1180984 is a reply to message #1175093]
||Mon, 11 November 2013 09:38
| Jan Koehnlein
Registered: July 2009
There is not too much code needed for a shared terminals grammar. Most |
of it is automatically generated by the individual consuming languages.
E.g. I wouldn't expect any UI contribution for the terminal language.
For our own Terminals we have a minimal config incorporated in the MWE2
workflow for bootstrapping Xtext (last few lines):
The ParsetreeConstructorFragment is obsolete. You will need the
generated GrammarAccessFragment. The most reusable manually implemented
component will probably be the IValueConverterService.
Am 07.11.13 15:18, schrieb Tatiana Fesenko:
> Creating a dedicated grammar which extends the common Xtext terminals is
> . However, defining a grammar in just the first step is DSL
> implementation which should be followed by changes in the mwe2 file and
> possible Java code customization. Unfortunately, I didn't find any
> documentation with recipes or best practices how to do it. Can you
> suggest useful resources?
> I am asking because we used this approach in our grammar and we faced
> several issues with it. For example, Xtext generates a preferences page
> for custom terminals which fails to open with
> com.google.inject.CreationExceptions. It happens because Guice
> OurTerminalsRuntimeModule extends DefaultRuntimeModule which uses
> dependencies (e.g. for DocumentPartitioner) that are normally bound to
> and in the code generated by the Antlr component. And an Antlr component
> cannot be used for the custom Terminals grammar because it is "without
> production rules". I looked how this situation is handled in Xtext
> itself - the preferences page for Xtext Common terminals was simply
> excluded from the plugin.xml, but it's there in the
> . I guess we can recommend to comment out the preferences page extension
> for the custom terminals.
> Let's share experience with creating custom terminals and advise best
> practices here. Thanks,
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Get professional support from the Xtext committers at www.typefox.io
Powered by FUDForum
. Page generated in 0.01501 seconds