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 Klein
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 Dietrich
Messages: 6292
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
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 Dietrich
Messages: 6292
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
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 Klein
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 Klein
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 Sep 16 07:32:39 GMT 2014

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

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