Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Specific cross-reference
Specific cross-reference [message #1385871] Wed, 11 June 2014 20:29 Go to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi,

I am creating an DSL language.

I would like to do domething like this :


welcome 2 :
   consequences 2.1 : doSomething
                2.2 : doOtherThing



I would like to have a reference between the number 2 from welcome and the number 2 from consequences.

Your help will be welcome.

best regards,
Felix
Re: Specific cross-reference [message #1385873 is a reply to message #1385871] Wed, 11 June 2014 20:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13313
Registered: July 2009
Senior Member
Hi,

i dont know what this question is about? do you have problems to write a grammar for that?

the only thing you need to know is:


xxx=[YYY] is short for xxx=[YYY|ID] which means "parse an ID to refer to a YYY

=> you would have to change that to xxx=[YYY|INT] + maybe change the IQualifiedNameProvider as well since the default one will pick only string attributes named name


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Specific cross-reference [message #1385884 is a reply to message #1385873] Thu, 12 June 2014 03:52 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi,

What I want to do is this :
AlternativeDeclaration:
	"welcome" id=INT ":"
               "consequences" id1=INT "." id2=INT  ":" "doSomething"
                              id3=INT "." id4=INT  ":" "doOtherThing"
;   


I would like to know if can make id1 to be the same number as id. For example, if id=2 then id1 should 2 (id1=id).
Re: Specific cross-reference [message #1385885 is a reply to message #1385884] Thu, 12 June 2014 04:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13313
Registered: July 2009
Senior Member
hi,

so you have to write a check in the validator that simply ensures that the use uses the same number at both places.

to have cross ref func (cmd click) you have to make it an actual cross ref or adapt HyperlinkHelper


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Specific cross-reference [message #1385889 is a reply to message #1385885] Thu, 12 June 2014 06:08 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
I don't understand why you need to retype the "2" in the consequences.
From the grammar you gave us,
it's already clear that these consequences belongs to the welcome with id = 2.

So it's better to get it in the generator using this hierarchy.
Re: Specific cross-reference [message #1386023 is a reply to message #1385889] Fri, 13 June 2014 04:00 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Thank you very much for your advise.

I will need your help for something else. Actually, I don't know how to start.
I have create this grammar:
/***   Alternatives ****/
Alternative 1:
    for {e1, e2, e3} select :
    R1 or R2 or R3;

Alternative 2:
    for {e6, e7, e8} select :
    R6 or R7 or R8;



/***   Decision appears when the user make a choice from [b][i]alternative i[/i][/b], [b][i]alternative i[/i][/b] will be automatically delete from the file ****/
Decision 1 select R7 for {e6, e7, e8} :
    consequences : decision 1.0 select R2 for {e1, e2, e3} and exclude R7 for {e6,e7,e8}



/***   Tell if the rule has to be excluded or Apply when the decision is validate. Automatically, Decision will be delete from the file ****/
Exclude rule R10 for {e9};
Apply rule R12 for {e10,e11};


What I want to do is this :
1 - I have a file which contains only some Alternatives.
2 - An user has a possibility to make a choise from an Alternative
3 - Decision appears when the user make a choice from Alternative i, Alternative i will be automatically delete from the file
4 - Tell if the rule has to be exclude or Apply when the Decision is validate. Automatically, the Decision will be delete from the file

The problem is that, I don't know howI can do that.

Thank you in advance for your help.

[Updated on: Fri, 13 June 2014 10:42]

Report message to a moderator

Re: Specific cross-reference [message #1386027 is a reply to message #1386023] Fri, 13 June 2014 06:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13313
Registered: July 2009
Senior Member
i dont think it is a good idea todo that.

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Specific cross-reference [message #1386073 is a reply to message #1386027] Fri, 13 June 2014 10:45 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
What do you suggest?
Re: Specific cross-reference [message #1386075 is a reply to message #1386073] Fri, 13 June 2014 10:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13313
Registered: July 2009
Senior Member
dont use xtext for that. is not made for such a

automatically delete stuff when user uses it somewhere else (that is how i understand your problem)

but maybe i got your problem wrong. maybe you could post several sample models and what shall happen when a user does what action


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Specific cross-reference [message #1386077 is a reply to message #1386075] Fri, 13 June 2014 11:03 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi,

1 - when we use java code, if we add a specific element, it will automatically notice us to import the library. How can we make that using Xtext
2 - If I understand what you are saying, it is not possible to dynamically editing a file in Xtest.
Re: Specific cross-reference [message #1386081 is a reply to message #1386077] Fri, 13 June 2014 11:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13313
Registered: July 2009
Senior Member
Hi,

1 - autoimport is of course possible. it can be done with xbase based languages. you can do something similar (you have todo it yourself)
2 - it is possible, the point is what triggers the auto edit - you want todo this by typing right? - since xtext recreates the ast all the time, since during typing the model may be broken and not parsed at all


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Specific cross-reference [message #1386165 is a reply to message #1386081] Fri, 13 June 2014 21:21 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi Christian,
you understand what I want to do.

Your advice is useful.

Maybe it will be easier to have a java code to edit my file and then, the model wont be broken.
Re: Specific cross-reference [message #1386166 is a reply to message #1386165] Fri, 13 June 2014 21:32 Go to previous message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi I forget something,

I do not want to edit the file by typing, I will just need to select a few elements (maximum 2) from a specific list.
I want XText to add automatically the text corresponding of the selection I made because.

Axample:
If I select alternative 1 , remove the line in the file corresponding of that and add a line for the decision.
Previous Topic:where can I store analysis data for reuse
Next Topic:Parse Xtext Editor Contents inside CustomEditor
Goto Forum:
  


Current Time: Sun Jan 19 04:59:48 GMT 2020

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

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

Back to the top