Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » how to create across reference in the local scope
how to create across reference in the local scope [message #719888] Mon, 29 August 2011 10:34 Go to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 92
Registered: July 2009
Member
Dear All

I have the following definition in my language

RootRef:
Open
;

Open:
'open' name=ID 'from' root=[Implementation::MemopsRoot|STRING]
;

the idea being to be able to write

open exampleRoot from "file-name"


so I can can open a named reference to an instance of a MemopsRoot from a file. However i am now in a bind: how do I create a MemopsRoot in the local scope so I can bind to it later and where does the String ie file-name get put. I thought I might be able to create the MemopsRoot on the fly during scope resolution, however, the object referenced by an Open instances from field created during parsing is an EGenericType and doesn't seem to contain the file-name anywhere. Any help obviously much appreciated

regards
gary
Re: how to create across reference in the local scope [message #732228 is a reply to message #719888] Tue, 04 October 2011 09:43 Go to previous messageGo to next message
eecolor is currently offline eecolorFriend
Messages: 36
Registered: September 2011
Member
I am sorry I can not help you with that. I am very interested how this would be done.

As far as I can tell xText scopes work a bit differently, instead of asking if a specific reference is correct they ask what is available. This means that you would need to add objects for all available MemopsRoot instances. This would would give you content assist as well.

The most likely suggestion you will get is to create DSL files for the MemopsRoot instances, make them available to your project and import them.

I would love to know how you would create instances at runtime in the scope provider.
Re: how to create across reference in the local scope [message #732279 is a reply to message #732228] Tue, 04 October 2011 12:06 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
You need to alter your grammar to the following (untested!) and make sure that you configured the ImportURIScopingFragment (see the User Guide for more details):
RootRef: 'open' root=[Implementation::MemopsRoot] 'from' importURI=STRING;

This should work out-of-the-box.


Previous Topic:duplicate a term
Next Topic:Reference a feature by another name
Goto Forum:
  


Current Time: Fri Apr 19 08:57:22 GMT 2024

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

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

Back to the top