Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to I get a handle on my language's Grammar/Grammar Access?
How to I get a handle on my language's Grammar/Grammar Access? [message #1839572] Wed, 24 March 2021 04:26 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 74
Registered: August 2017
Member
So I use xtext dsls along with Sirius diagrams, for example.

I need to validate a user's entry in renaming diagrams/diagram elements so that they do not rename it to a keyword of my DSL. How do I get a handle on the Grammar/GrammarAccess in order to use GrammarUtil.getAllKeywords?

I tried injecting MyDslGrammarAccess in my Java class but then I get a "Could not initialize class error", which I assume is coming from the attempt at injection because the only other thing present in the class is a static set of Strings that is set to the call GrammarUtil.getAllKeywords

Thanks
Re: How to I get a handle on my language's Grammar/Grammar Access? [message #1839586 is a reply to message #1839572] Wed, 24 March 2021 08:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13939
Registered: July 2009
Senior Member
where are you calling this from? how is the class you inject to created?
see also http://koehnlein.blogspot.com/2012/11/xtext-tip-how-do-i-get-guice-injector.html


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to I get a handle on my language's Grammar/Grammar Access? [message #1839637 is a reply to message #1839586] Wed, 24 March 2021 23:04 Go to previous message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 74
Registered: August 2017
Member
Thank you Christian your link helped me solve my problem!

[Updated on: Thu, 25 March 2021 00:28]

Report message to a moderator

Previous Topic:Making it possible to write Xtext grammar in DSL
Next Topic:Xtext leaving Eclipse simultaneos release with 2021-06
Goto Forum:
  


Current Time: Fri May 14 11:13:46 GMT 2021

Powered by FUDForum. Page generated in 0.01751 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top