Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Duplicate references in Xtext Editor(How to remove the duplicate references)
icon5.gif  Duplicate references in Xtext Editor [message #1098009] Fri, 30 August 2013 13:17 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi all,
My grammar looks something like this:

ComponentA:
"compoA" name=ID '{'
"description" Description=STRING
}


ComponentB:
"compoB" name=ID '{'
"refers" "[" (components+=[ComponentA] ("," components+=[ComponentA])*)? "]"
'}'
;

So some of the valid examples are:

compoA name1 { description "description" }
compoA name2 { description "description" }
compoA name3 { description "description" }

AND:
compoB name1B { refers [name1,name2] }
compoB name2B { refers [name1,name1] }
compoB name3B { refers [name1,name1,name1] }


As you can see duplicate references to name1 is allowed in last two examples.
Can I avoid it ? Or Validator is the ONLY way to display an error ??


Arshad
Re: Duplicate references in Xtext Editor [message #1098028 is a reply to message #1098009] Fri, 30 August 2013 13:54 Go to previous message
Ian McDevitt is currently offline Ian McDevittFriend
Messages: 70
Registered: December 2012
Location: Belfast
Member
Duplicate references are normally ok in most languages except in certain language-specific contexts which is why you'll need a context sensitive check, which would be in the validator where you can give a helpful message plus possible quick fixes.

The alternative of trying to prevent it without context through syntax (if even possible) would not have this so you'd need a very good reason to try it another way.

Previous Topic:Disable terminal within rule
Next Topic:Output folder
Goto Forum:
  


Current Time: Thu Apr 18 05:46:11 GMT 2024

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

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

Back to the top