/**
*
- * Code to convert node tree to Javascript...
+ * Code to convert node tree to Vala...
*
- * usage : x = (new JsRender.NodeToJs(node)).munge();
+ * usage : x = (new JsRender.NodeToVala(node)).munge();
*
*
*
// initialize line data..
node.line_start = this.cur_line;
node.line_end = this.cur_line;
- node.lines = new Gee.ArrayList();
+ node.lines = new Gee.ArrayList<int>();
node.line_map = new Gee.HashMap<int,string>();
-
+ if (parent == null) {
+ node.node_lines = new Gee.ArrayList<int>();
+ node.node_lines_map = new Gee.HashMap<int,Node>();
+ }
}
public void addLine(string str= "")
{
this.cur_line++;
+ //this.ret += "/*%d*/ ".printf(this.cur_line-1) + str + "\n";
this.ret += str + "\n";
}
public void addMultiLine(string str= "")
{
- this.cur_line++;
+
this.cur_line += str.split("\n").length;
- this.ret += str + "\n";
+ //this.ret += "/*%d*/ ".printf(l) + str + "\n";
+ this.ret += str + "\n";
}
// class header..
// class xxx { WrappedGtk el; }
this.node.line_start = this.cur_line;
- this.addLine(inpad + "public class " + this.xcls + " : Object \n" + this.inpad + "{");
+
+ this.top.node.setNodeLine(this.cur_line, this.node);
+
+ this.addLine(inpad + "public class " + this.xcls + " : Object");
+ this.addLine(this.inpad + "{");
this.addLine(this.pad + "public " + this.cls + " el;");
var iter = cls.props.map_iterator();
while (iter.next()) {
var p = iter.get_key();
- print("Check Write %s\n", p);
+ //print("Check Write %s\n", p);
if (!this.node.has(p)) {
continue;
}
void iterChildren()
{
this.node.line_end = this.cur_line;
+ this.node.sortLines();
+
if (this.depth > 0) {
this.addLine(this.inpad + "}");
}
var iter = this.node.items.list_iterator();
- var i = -1;
+
while (iter.next()) {
this.addMultiLine(this.mungeChild(iter.get()));
}