Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to fetch value from my text
How to fetch value from my text [message #1790324] Fri, 08 June 2018 11:37 Go to next message
shubhankar chowdhury is currently offline shubhankar chowdhuryFriend
Messages: 13
Registered: January 2018
Junior Member
Hi

I have my grammar which looks like this :

.......
.............

DataType2:
'DataType2' name=ID
'{'
'DataTypeRef' DataTypeRef = ( BasicType | OwnType )
'}';
.......


BasicType : Basic8 | Basic16 | BasicBool ;


Basic8 :{Basic8 } "unit9";
Basic16 :{Basic16 } "unit18";
BasicBool :{BasicBool} "boolean";



OwnTypes : referenced=[TypeX| QualifiedName];


TypeX: BasicDataType;

.................
..................


Now when user can write a file with the above data :

DataType2 abc {
DataTypeRef unit18 //(here i get a dropdown with values "unit9,unit18,bool" )
}

till here everything is fine ...:)

............................

now I want to fetch the "unit8" from the file in my back-end.
How to get this value from the user file, as I am not able to fetch the value from the object?
Re: How to fetch value from my text [message #1790325 is a reply to message #1790324] Fri, 08 June 2018 11:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
Hi,

i do not understand your question.

myDataType2.getDataTypeRef() should give you an instance of Basic16


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to fetch value from my text [message #1790330 is a reply to message #1790325] Fri, 08 June 2018 11:51 Go to previous messageGo to next message
shubhankar chowdhury is currently offline shubhankar chowdhuryFriend
Messages: 13
Registered: January 2018
Junior Member
Yes, it is giving the instance of Basic16 but form that object I am not able to retrieve unit18.
Re: How to fetch value from my text [message #1790332 is a reply to message #1790330] Fri, 08 June 2018 11:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
i dont understand what you mean. do you have multiple different Basic16 ?
if not the mapping is 1:1

if yes you should have a different grammar e.g.

Basic16 :{Basic16 } value="unit18";


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to fetch value from my text [message #1790333 is a reply to message #1790332] Fri, 08 June 2018 11:56 Go to previous messageGo to next message
shubhankar chowdhury is currently offline shubhankar chowdhuryFriend
Messages: 13
Registered: January 2018
Junior Member
No, I have only 1 basic16
Re: How to fetch value from my text [message #1790335 is a reply to message #1790333] Fri, 08 June 2018 11:57 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
you can change it anyway

Basic16 :{Basic16 } value="unit18";


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Controlling generator behavior with parameters
Next Topic:Generate code with Xtend of ReqIF model
Goto Forum:
  


Current Time: Wed Sep 26 12:17:13 GMT 2018

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

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

Back to the top