Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Defining variable inside your language document?
Defining variable inside your language document? [message #1837230] Mon, 25 January 2021 10:47 Go to next message
Eclipse UserFriend
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 12:12] by Moderator

Re: Defining variable inside your language document? [message #1837246 is a reply to message #1837230] Tue, 26 January 2021 01:57 Go to previous messageGo to next message
Eclipse UserFriend
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 02:50 Go to previous messageGo to next message
Eclipse UserFriend
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 05:34 Go to previous messageGo to next message
Eclipse UserFriend
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 05:45 Go to previous message
Eclipse UserFriend
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: Sun May 11 07:58:42 EDT 2025

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

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

Back to the top