beginner question about outline and label [message #696170] |
Wed, 13 July 2011 08:21  |
Eclipse User |
|
|
|
I am currently working on building an IDE for ATS (www.ats-lang.org). I have a simple question about building Outline and label in Xtext. Any suggestion is highly appreciated. For clarity, the following is an example grammar.
=======================
grammar org.Test1 with org.eclipse.xtext.common.Terminals
generate test1 "http://www.Test1.org"
program:
m1=ent1
m2=ent2
;
ent1:
m=ab
;
ent2:
m=cd
;
ab:
'a'|'b'
;
cd:
'c'|'d'
; =======================
I want to show all the information of m1 and m2 in the label of program. My first idea is to add a "tostring" method to all of those class (program, ent1, ent2, etc.). But they are generated by Xtext. The following is what I am doing now.
=======================
String text(program ele) {
return "program " + ele.getM1().getM() + " " + ele.getM2().getM();
} ========================
The method seems a little bit tedious. What's the usual way to get all the information of a semantic element? Does Xtext support converting a semantic element back to the string?
Thanks a lot.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03213 seconds