Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext: Referencing Elements of one DSL from another DSL Problem(Xtext: Referencing Elements of one DSL from another DSL NLP)
Xtext: Referencing Elements of one DSL from another DSL Problem [message #1024370] Tue, 26 March 2013 06:59 Go to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi ,

I was trying out an example of Referencing Elements of one DSL from another DSL . I followed this example from Christian.

http://christiandietrich.wordpress.com/2012/08/07/xtext-referencing-elements-of-one-dsl-from-another-dsl/

Here is my grammar
grammar org.xtext.example.definitions.Definitions with org.eclipse.xtext.common.Terminals
 
generate definitions "http://www.xtext.org/example/definitions/Definitions"
 import "http://www.eclipse.org/emf/2002/Ecore"
Model:
    definitions+=Definition*;
 
Definition:
    'define' name=[EClass];



Referencing Grammar
grammar org.xtext.example.usages.Usages with org.eclipse.xtext.common.Terminals
 
generate usages "http://www.xtext.org/example/usages/Usages"
 
import "http://www.xtext.org/example/definitions/Definitions" as def

Model:
    usages+=Usage*;
     
Usage:
    'use' definition=[def::Definition];



Exception thrown while running

1593 [main] INFO ipse.xtext.generator.LanguageConfig - generating infrastructure for org.xtext.example.usages.Usages with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, SerializerFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment,
BuilderIntegrationFragment, GeneratorFragment, FormatterFragment, LabelProviderFragment, OutlineTreeProviderFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment, Junit4Fragment, RefactorElementNameFragment, TypesGeneratorFragment, XbaseGeneratorFragment, CodetemplatesGeneratorFragment, CompareFragment
java.lang.NullPointerException
	at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl.hasExtendedMetaData(GenPackageImpl.java:4388)
	at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl.initialize(GenPackageImpl.java:2777)
	at org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelImpl.initialize(GenModelImpl.java:2265)
	at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.getSaveAndReconcileGenModel(EcoreGeneratorFragment.java:652)
	at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.generate(EcoreGeneratorFragment.java:207)

Re: Xtext: Referencing Elements of one DSL from another DSL Problem [message #1024374 is a reply to message #1024370] Tue, 26 March 2013 07:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
HI,

i cannot reproduce this using Xtext 2.4.0.
which version of org.eclipse.emf.codegen.ecore to you use? its 2.8.x in my case

a little hint: with

Definition:
'define' name=[EClass];

you will have to do additional work to get the Definitions actually indexed and thus the referencing working


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext: Referencing Elements of one DSL from another DSL Problem [message #1028460 is a reply to message #1024374] Thu, 28 March 2013 09:30 Go to previous messageGo to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi Christian,

I have been using Xtext 2.3.1 latest from Xtext.org . Can you guide what needs to be done for definition to be used as referencing from Usage in Rule file.


Regards,
Sri M.V
Re: Xtext: Referencing Elements of one DSL from another DSL Problem [message #1028528 is a reply to message #1028460] Thu, 28 March 2013 11:28 Go to previous messageGo to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi Christian ,

I have already added Scope providers to load content from an ecore model. Is there anything different which is required to do cross referencing ?

Re: Xtext: Referencing Elements of one DSL from another DSL Problem [message #1028544 is a reply to message #1028528] Thu, 28 March 2013 11:45 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes indexing is done before linking so you have to use the node model
to get the name.

--
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
Previous Topic:Handling of boolean attributes while serialization
Next Topic:case keywords as you type
Goto Forum:
  


Current Time: Tue Apr 23 08:18:26 GMT 2024

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

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

Back to the top