Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Partial parsing to an EObject which contains a cross reference across grammars(Partial parsing of a text to an EObject which contains a cross reference to another EObject which is defined in another grammar (cross-referencing across grammars).)
icon5.gif  Partial parsing to an EObject which contains a cross reference across grammars [message #755629] Wed, 09 November 2011 06:05
Suraj Varghese is currently offline Suraj VargheseFriend
Messages: 4
Registered: November 2011
Junior Member

During model to model transformation, we sometimes parse code snippets to get the Grammar based EObjects.
This way of working with certain pieces helps because we need not write code for the transformation of the snippet.
Parsing of snippet works fine during the transformation as long as there is no cross reference (across different grammar; I have not tried within same grammar too).
I tried to use ILinker.linkModel after parsing but that fails since I am not using XTextResource during parsing (since the parse is partial).
The reason it fails is because it does not set the referenced object in the EObject.
I have not tried PartialParsingHelper because I do not have the original root node (I am trying to construct that right now).

The code is as follows:

Grammar definitions


/* First.xtext */

Model : ...

'Statement' name=ID



/* Second.xtext */

import ...


BasicStatement | ReferenceStatement

'Basic' name=ID

'Reference' reference=[first::Statement]


Java code snippet in my model to model transformation code.


IParseResult parseResult = parser.parse("Statements", new StringReader("Reference HelloWorld"))
if (parseResult.getRootNode() != null
&& !NodeContentAdapter.containsNodeContentAdapter(parseResult.getRootNode()))
EObject eObject = parseResult.getRootASTElement();


// The reference feature of ReferenceStatementEObject in above is null.

Can somebody throw some light as to where should I start to look at to fix this issue?

I am using XText 1.0.1.
Previous Topic:[ATL] Atl plugin problem ecore with referenced ecore
Next Topic:[ATL] Same emf resource as input & output
Goto Forum:

Current Time: Sun Jul 21 05:19:28 GMT 2024

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

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

Back to the top