Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Maintain order in the file?  () 1 Vote
Maintain order in the file? [message #693081] Tue, 05 July 2011 18:30 Go to next message
Timotei Mising name is currently offline Timotei Mising nameFriend
Messages: 89
Registered: March 2010
Member
Hello!

I have a little problem. The editor and the parsed tree it seems it doesn't keep the order. That is, for example for the code:

#textdomain wesnoth-dw
[textdomain]
    name="wesnoth-dw"
[/textdomain]


It generates the tree (which can be seen in the outline):
textdomain
|--name
#textdomain


while the order should be the one in the file. How I can fix it? Also, the same problem arises when, let's say, I get an instance of the root node, and call
root.eAllContents();

iterator. The iterator will give me the same order as in the outline of the file.

I think it's the way I've defined the grammar, but is there any chance to make it parse in the order in the file?

This is a bit of grammar for the specified code:
WMLRoot:
	( Tags += WMLTag
	| MacroCalls += WMLMacroCall
	| MacroDefines += WMLMacroDefine
	| Textdomains += WMLTextdomain
	| IfDefs += WMLPreprocIF
	)*
	;


Where WMLTag is the "[textdomain]" tag, while the ifdef is the "#textdomain" thingy.

Thanks,
Timo
Re: Maintain order in the file? [message #693091 is a reply to message #693081] Tue, 05 July 2011 19:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

You add the parsed stuff to different lists (tags,MacroCalls,..) so no wonder that the tree is not linear. You could Recife this to only one list (List+=...) and a Common supertype (supertype: WMLTag|WMLMacroCall|...;

Regards Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Maintain order in the file? [message #693126 is a reply to message #693091] Tue, 05 July 2011 21:03 Go to previous message
Timotei Mising name is currently offline Timotei Mising nameFriend
Messages: 89
Registered: March 2010
Member
Thanks a lot Christian!

It works now Smile
Previous Topic:JavaValidator Xtext 2.0 Migration
Next Topic:How to put Xtext project into version control system
Goto Forum:
  


Current Time: Sat Apr 20 03:39:20 GMT 2024

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

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

Back to the top