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: 100
Registered: August 2017
Senior 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: 14661
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


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: 100
Registered: August 2017
Senior 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:Formatter2 Text Replacement
Goto Forum:
  


Current Time: Thu Mar 28 22:44:07 GMT 2024

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

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

Back to the top