Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Defining variable inside your language document?
Defining variable inside your language document? [message #1837230] Mon, 25 January 2021 15:47 Go to next message
Andreas Berger is currently offline Andreas BergerFriend
Messages: 3
Registered: January 2021
Junior Member
Hello,

Is it possible to give the user of my language the possibility, that he can define variables inside the document and reference to them later on?

For example:
Config.mylanguage
Myconfig config{
	globalParameter{
		date = "2020-10-30"
	}
	action1{
		name "action1"
                starting_date = $date
      }
      action2{
		name "action2"
                starting_date = $date
      }
}


Best regards
Andreas

[Updated on: Mon, 25 January 2021 17:12]

Report message to a moderator

Re: Defining variable inside your language document? [message #1837246 is a reply to message #1837230] Tue, 26 January 2021 06:57 Go to previous messageGo to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 157
Registered: February 2016
Senior Member
Hello Andreas,

Yes, it is possible. Similar concept has been implemented in the Eclipse MWE2 project, see the usage of the DeclaredProperty in the Mwe2.xtext file.

Hope that helps,
Tamás
Re: Defining variable inside your language document? [message #1837250 is a reply to message #1837230] Tue, 26 January 2021 07:50 Go to previous messageGo to next message
Andreas Berger is currently offline Andreas BergerFriend
Messages: 3
Registered: January 2021
Junior Member
Thank you Tamas I'll have a look today.
Re: Defining variable inside your language document? [message #1837258 is a reply to message #1837250] Tue, 26 January 2021 10:34 Go to previous messageGo to next message
Andreas Berger is currently offline Andreas BergerFriend
Messages: 3
Registered: January 2021
Junior Member
Unfortunatly I don't know how to adapt this to my example. Are there any examples or keywords in the documentation where you can point me at? I don't know under which keyword I can find any information or examples regarding this topic.
Re: Defining variable inside your language document? [message #1837260 is a reply to message #1837258] Tue, 26 January 2021 10:45 Go to previous message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 157
Registered: February 2016
Senior Member
As a starting point, you can study the Cross-References section of the Xtext The Grammar Language Reference.
Previous Topic:Dokumentation for Formatter2 API
Next Topic:Xtend with Maven does not preserved semantic
Goto Forum:
  


Current Time: Fri Apr 19 21:28:00 GMT 2024

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

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

Back to the top