Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtend] Ecore post processing(Syntax errors)
[xtend] Ecore post processing [message #698770] Wed, 20 July 2011 03:53 Go to next message
Balazs Varnai is currently offline Balazs Varnai
Messages: 21
Registered: June 2011
Junior Member
Hi,

Consider the following '.ext' file for my xtxt


process(xtext::GeneratedMetamodel this) :
  process(ePackage)
;
 
process(ecore::EPackage this) :
    {
	var i = 100
	}
;


The problem is that language constructs like var/for/if etc., are underlined as syntax errors. I tried to use java 'println' but 'import' also fails. Xtend project nature was added.

Thanks!

Re: [xtend] Ecore post processing [message #698782 is a reply to message #698770] Wed, 20 July 2011 04:20 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander Nittka
Messages: 1151
Registered: July 2009
Senior Member
Hi,

note that ".ext" files are not Xtend2-Files. It is the "old" Xtend. The eclipse help also contains the language definitions for Xpand/Xtend/Check.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: [xtend] Ecore post processing [message #698783 is a reply to message #698770] Wed, 20 July 2011 04:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
Hi,

if you write invalid syntax you of course get syntax errors:
.ext is Xpand/Xtend(1)
.xtend is Xtend(2)

~Christian
Re: [xtend] Ecore post processing [message #698788 is a reply to message #698783] Wed, 20 July 2011 04:26 Go to previous messageGo to next message
Balazs Varnai is currently offline Balazs Varnai
Messages: 21
Registered: June 2011
Junior Member
Let me quote the xtext2 reference section Customized Post Processing

Quote:

As a last step, the generator invokes the post processor for every generated Ecore model. The post processor expects an Xtend1 file with name MyDslPostProcessor.ext (if the name of the grammar file is MyDsl.xtext) in the same folder as the grammar file.


So I can use xtend2 files in post processing? Thanks!

By the way Eclipse help contains Xtend content, no mention of xtend1/xtend2 which is kind of misleading.

[Updated on: Wed, 20 July 2011 04:29]

Report message to a moderator

Re: [xtend] Ecore post processing [message #698791 is a reply to message #698788] Wed, 20 July 2011 04:30 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander Nittka
Messages: 1151
Registered: July 2009
Senior Member
Well, what does the quote say?
Quote:
The post processor expects an Xtend1 file


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: [xtend] Ecore post processing [message #717876 is a reply to message #698791] Mon, 22 August 2011 11:44 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan Ujhelyi
Messages: 200
Registered: July 2009
Senior Member
You can use Xtend2 files if you are not afraid to some customization to the generator process: see http://christiandietrich.wordpress.com/2011/07/22/customizing-xtext-metamodel-inference-using-xtend2/ for details.
Re: [xtend] Ecore post processing [message #717878 is a reply to message #717876] Mon, 22 August 2011 11:49 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
Hi Zoltan,

this thread was the inspiration for my blogpost Wink

~Christian
Previous Topic:While ,Run As -> Generate Xtext Artifacts
Next Topic:Generating multiple files with xtend
Goto Forum:
  


Current Time: Fri Aug 01 07:51:52 EDT 2014

Powered by FUDForum. Page generated in 0.05006 seconds