Skip to main content



      Home
Home » Modeling » TMF (Xtext) » var dependent on other var
var dependent on other var [message #1814507] Thu, 12 September 2019 08:38 Go to next message
Eclipse UserFriend
Hello,

First the example grammar:

Model:
	Command+=COMMAND*;
	
COMMAND:
	SET;
	
SET:
	name = 'Set'
	param0 = DAC
	param1 = ADDRESS;

DAC:
	name = 'DAC' 
	value = ('0x01' | '0x02' | '0x03');

ADDRESS:
	name = 'Address'
	value = ('0x8000' | '0x3000' | '0x2000');


What I want is, that when I edit DAC.value = 0x01 the address shall be 0x8000. Same for 0x02 and 0x03 => different addresses.
I tried a while with scoping but don't find the breakthrough how to implement this.
Is there a way? The Grammar shall be fixed to this values.

thanks,
MH
Re: var dependent on other var [message #1814508 is a reply to message #1814507] Thu, 12 September 2019 08:41 Go to previous messageGo to next message
Eclipse UserFriend
maybe you can have a look at the feature called "auto edit"
Re: var dependent on other var [message #1814516 is a reply to message #1814508] Thu, 12 September 2019 09:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Are you sure you really want the Address to be entered at all? It just seems to require your user to work harder and to have an opportunity to enter redundant values wrongly.

If you need it in the model, then enrich your Ecore model with a derived property that returns the address.

If you just want to read it, generate a report output with all the derived details.

If 0x01 => 0x800 is just an initial default, you can override the setDAC method to setADDRESS too.

Regards

Ed Willink
Re: var dependent on other var [message #1814554 is a reply to message #1814516] Fri, 13 September 2019 03:24 Go to previous message
Eclipse UserFriend
Hi,
auto edit is a nice way but seems to work just in Eclipse.

For editing, i need all parameters, DAC and ADDRESS and actually some more, and I want to prevent wrong addresses. Address has to be in a certain space which is reserved. So a given value is a good starting point.

I have a look at the Ecore model and derived property.

Thanks
MH
Previous Topic:Xtend validation a unique MAC address value in language
Next Topic:Xtext & Eclipse platform
Goto Forum:
  


Current Time: Mon Apr 21 10:01:39 EDT 2025

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

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

Back to the top