Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Converting newly build DSL code to txt file
Converting newly build DSL code to txt file [message #1715602] Tue, 24 November 2015 15:43 Go to next message
Mohsin waqas is currently offline Mohsin waqasFriend
Messages: 33
Registered: June 2015
Member
Hi,

the example grammar looks like
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=ID ('from' from=[Greeting])? '!';

and lets say dsl looks like
Hello john from smith !
Hello moli from alex !
Hello alex from ilian !
Hello smith from john !
Hello ilian !

using
https://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/
i have created the txt files.

but the problem is I want to generate just one txt file containing the whole dsl code.
I think I have to alter MyDslGenerator.xtend but I am not sure in which direction should i go.
please help thanks
Re: Converting newly build DSL code to txt file [message #1715608 is a reply to message #1715602] Tue, 24 November 2015 16:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Have a look at the generator created by the new project wizards.
Is basically moving the for loop to the rich string

'''
«FOR e : collection»
do sth with «e»
«ENDFOR»
'''


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Converting newly build DSL code to txt file [message #1715681 is a reply to message #1715608] Wed, 25 November 2015 09:02 Go to previous message
Mohsin waqas is currently offline Mohsin waqasFriend
Messages: 33
Registered: June 2015
Member
ok thank you so much Smile
Previous Topic:Getting errors and warnings headless?
Next Topic:XText 2.9 and single quotes
Goto Forum:
  


Current Time: Sat Apr 20 00:04:32 GMT 2024

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

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

Back to the top