Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » CrossReference Side-effect
CrossReference Side-effect [message #872982] Thu, 17 May 2012 08:32 Go to next message
Dmitriy Shishkin is currently offline Dmitriy ShishkinFriend
Messages: 20
Registered: May 2012
Junior Member
Hi,
Here is part of my grammar:

Definition:
  '('  'def'
  name = ID ')';

Command:
  '('  'command'  
  name = ID  
  type = [Definition | ID]  ')';


And main trouble is that command must have side-effect: if there is'n reference for type, commant must create this one, and next commands must referens to this.

something like that:

Command:
  '('  'command'  
  name = ID  
  (
  	(type = [Definition | ID]) |
  	(id = ID)
  )  
  ')';


But it does'n work
I will add that I can't use any additional keywords - I trying to define an already existing grammar

Is there any way to do that side-effect on Xtext?

Any advice is greatly appreciated.
Dmitriy.

[Updated on: Thu, 17 May 2012 08:32]

Report message to a moderator

Re: CrossReference Side-effect [message #876549 is a reply to message #872982] Thu, 24 May 2012 20:26 Go to previous message
Dmitriy Shishkin is currently offline Dmitriy ShishkinFriend
Messages: 2
Registered: May 2012
Junior Member
so, I added a Syntactic Predicate for '(id = ID)' and all references becomes definitions, but reference still remained in my meta-model.

Constant:	
  name = ID;
	
ConstantRef:
  ref = [Constant|ID];

Term:
  =>Constant | ConstantRef;

Command:
  '('  'command'  
  name = ID  
  (
     term = Term
  )  
  ')';


Next, I override generated Linker and in method AfterModelLinked I try to find first occurance of ID and mark it as Definition, any other with the same ID is marked as Reference.

In addition I tried to replace all Constant marked as Reference to ConstantRef in generated model.. It's works, but they immediately disappear from Outline and Hover tooltip doesn't work

Could anybody give me advise what I should do next?
Any advice is greatly appreciated.
Dmitriy.
Previous Topic:Expand Outline View on startup
Next Topic:Type Checking with JvmTypeParameter and JvmArgumentTypeReference
Goto Forum:
  


Current Time: Fri Apr 26 03:51:42 GMT 2024

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

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

Back to the top