Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext injected parser(xtext injected parser)
xtext injected parser [message #989207] Wed, 05 December 2012 08:52 Go to next message
Dana Klein is currently offline Dana KleinFriend
Messages: 63
Registered: October 2012
Member
@Inject
protected void setInjectedParser(IParser parser) {
this.parser = parser;
}

I want to manually run the xtext engine and i'm not sure when and where the setInjectedParser is being called.

thanks,
Re: xtext injected parser [message #989211 is a reply to message #989207] Wed, 05 December 2012 09:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Just make sure the class is created with Google guice. E.g. by
calling new mydslstsndalonesetup().createinjectoranddoemfregistration
if the code is called stsndalone

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext injected parser [message #989212 is a reply to message #989211] Wed, 05 December 2012 09:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
=>

Injector i = new MydslStandaloneSetup().createInjectorAndDoEMfRegistration()
MyClass c = i.getInstance(MyClass.class)

P.S: a bit more context in such questions would be helpful


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext injected parser [message #989230 is a reply to message #989212] Wed, 05 December 2012 10:03 Go to previous messageGo to next message
Dana Klein is currently offline Dana KleinFriend
Messages: 63
Registered: October 2012
Member
Ok thanks!

I will try to explain
I have my dsl as plugin.

i want to create a new app that use my dsl
so i tried to write this code:
JsonParser p = new JsonParser();
IParseResult r = p.parse(new StringReader("{}"));
//once that work it will be the file data instead of {}

but when i do the parse the node model builder is null and the following line has exception:
return doParse(ruleName, in, nodeModelBuilder.get(), 0);

and i'm not sure how to init nodeModelBuilder

i'm sure i missing some steps but i'm not quite familiar with the xtext process.

[Updated on: Wed, 05 December 2012 10:13]

Report message to a moderator

Re: xtext injected parser [message #989309 is a reply to message #989230] Wed, 05 December 2012 15:40 Go to previous message
Dana Klein is currently offline Dana KleinFriend
Messages: 63
Registered: October 2012
Member
Hey thank you for the help, i'm continuing in a different path.

but thanks!

[Updated on: Wed, 05 December 2012 15:41]

Report message to a moderator

Previous Topic:file parsing
Next Topic:Xtext/Xbase for writing complex math expressions
Goto Forum:
  


Current Time: Tue Mar 19 02:30:14 GMT 2024

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

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

Back to the top