Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Maintain order in the file?  () 1 Vote
Maintain order in the file? [message #693081] Tue, 05 July 2011 14:30 Go to next message
Eclipse UserFriend
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 15:00 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Maintain order in the file? [message #693126 is a reply to message #693091] Tue, 05 July 2011 17:03 Go to previous message
Eclipse UserFriend
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: Wed Jul 02 22:35:31 EDT 2025

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

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

Back to the top