3 * Code to convert node tree to Vala...
5 * usage : x = (new JsRender.NodeToVala(node)).munge();
9 * pack - can we come up with a replacement?
10 - parent.child == child_widget -- actually uses getters and effectively does 'add'?
14 * args -- vala constructor args (should really only be used at top level - we did use it for clutter originally(
15 * ctor -- different ctor argument
26 public class JsRender.NodeToVala : Object {
34 string cls; // node fqn()
41 Gee.ArrayList<string> ignoreList;
42 Gee.ArrayList<string> ignoreWrappedList;
43 Gee.ArrayList<string> myvars;
44 Gee.ArrayList<Node> vitems; // top level items
50 * ctor - just initializes things
51 * - wraps a render node
53 public NodeToVala( JsRender file, Node node, int depth, NodeToVala? parent)
59 this.inpad = string.nfill(depth > 0 ? 4 : 0, ' ');
60 this.pad = this.inpad + " ";
61 this.ipad = this.inpad + " ";
62 this.cls = node.xvala_cls;
63 this.xcls = node.xvala_xcls;
65 this.cur_line = parent == null ? 0 : parent.cur_line;
68 this.top = parent == null ? this : parent.top;
69 this.ignoreList = new Gee.ArrayList<string>();
70 this.ignoreWrappedList = new Gee.ArrayList<string>();
71 this.myvars = new Gee.ArrayList<string>();
72 this.vitems = new Gee.ArrayList<Node>();
75 // initialize line data..
76 node.line_start = this.cur_line;
77 node.line_end = this.cur_line;
78 node.lines = new Gee.ArrayList<int>();
79 node.line_map = new Gee.HashMap<int,string>();
81 node.node_lines = new Gee.ArrayList<int>();
82 node.node_lines_map = new Gee.HashMap<int,Node>();
88 string toValaNS(Node item)
90 var ns = item.get("xns") ;
91 //if (ns == "GtkSource") { technically on Gtk3?
92 // return "Gtk.Source";
96 public void toValaName(Node item, int depth =0)
100 var ns = this.toValaNS(item) ;
101 var cls = ns + item.get("xtype");
104 item.xvala_cls = cls;
107 string id = item.get("id").length > 0 ?
108 item.get("id") : "%s%d".printf(item.get("xtype"), this.vcnt);
113 if (id[0] == '*' || id[0] == '+') {
114 item.xvala_xcls = "Xcls_" + id.substring(1);
116 item.xvala_xcls = "Xcls_" + id;
122 this.vitems.add(item);
124 // setting id on top level class changes it classname..
125 // oddly enough we havent really thought about namespacing here.
127 } else if (!item.props.has_key("id")) {
128 // use the file name..
129 item.xvala_xcls = this.file.name;
131 item.xvala_id = this.file.name;
136 if (item.items.size < 1) {
139 for(var i =0;i<item.items.size;i++) {
140 this.toValaName(item.items.get(i), depth+1);
145 * Main entry point to convert a file into a string..
147 public static string mungeFile(JsRender file)
149 if (file.tree == null) {
153 var n = new NodeToVala(file, file.tree, 0, null);
157 n.toValaName(file.tree);
160 GLib.debug("top cls %s / xlcs %s\n ",file.tree.xvala_cls,file.tree.xvala_cls);
161 n.cls = file.tree.xvala_cls;
162 n.xcls = file.tree.xvala_xcls;
168 public string munge ( )
170 //return this.mungeToString(this.node);
175 this.ignore("xtype");
181 this.addTopProperties();
183 this.addPlusProperties();
186 this.addWrappedCtor();
188 this.addInitMyVars();
189 this.addWrappedProperties();
191 this.addAutoShow(); // autoshow menuitems
196 this.addUserMethods();
203 public string mungeChild( Node cnode)
205 var x = new NodeToVala(this.file, cnode, this.depth+1, this);
208 public void addLine(string str= "")
211 //this.ret += "/*%d*/ ".printf(this.cur_line-1) + str + "\n";
212 this.ret += str + "\n";
214 public void addMultiLine(string str= "")
217 this.cur_line += str.split("\n").length;
218 //this.ret += "/*%d*/ ".printf(l) + str + "\n";
219 this.ret += str + "\n";
223 public void globalVars()
225 if (this.depth > 0) {
228 // Global Vars..??? when did this get removed..?
229 //this.ret += this.inpad + "public static " + this.xcls + " " + this.node.xvala_id+ ";\n\n";
231 this.addLine(this.inpad + "static " + this.xcls + " _" + this.node.xvala_id+ ";");
240 // class xxx { WrappedGtk el; }
241 this.node.line_start = this.cur_line;
243 this.top.node.setNodeLine(this.cur_line, this.node);
245 this.addLine(inpad + "public class " + this.xcls + " : Object");
246 this.addLine(this.inpad + "{");
249 this.addLine(this.pad + "public " + this.cls + " el;");
251 this.addLine(this.pad + "private " + this.top.xcls + " _this;");
263 this.addLine(pad + "public static " + xcls + " singleton()");
264 this.addLine(this.pad + "{");
265 this.addLine(this.ipad + "if (_" + this.node.xvala_id + " == null) {");
266 this.addLine(this.ipad + " _" + this.node.xvala_id + "= new "+ this.xcls + "();"); // what about args?
267 this.addLine(this.ipad + "}");
268 this.addLine(this.ipad + "return _" + this.node.xvala_id +";");
269 this.addLine(this.pad + "}");
273 * when ID is used... on an element, it registeres a property on the top level...
274 * so that _this.ID always works..
277 void addTopProperties()
279 if (this.depth > 0) {
282 // properties - global..??
284 var iter = this.vitems.list_iterator();
289 if (!n.props.has_key("id") || n.xvala_id.length < 0) {
293 if (n.xvala_id[0] == '*') {
296 if (n.xvala_id[0] == '+') {
299 this.addLine(this.pad + "public " + n.xvala_xcls + " " + n.xvala_id + ";");
305 * create properties that are not 'part of the wrapped element.
312 GLib.debug("callinged addMhyVars");
315 this.addLine(this.ipad + "// my vars (def)");
319 var cls = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn());
322 GLib.debug("Gir factory failed to find class %s", this.node.fqn());
329 var iter = this.node.props.map_iterator();
330 while (iter.next()) {
332 var prop = iter.get_value();
334 if (this.shouldIgnore(prop.name)) {
338 // user defined method
339 if (prop.ptype == NodePropType.METHOD) {
342 if (prop.ptype == NodePropType.SPECIAL) {
346 if (prop.ptype == NodePropType.SIGNAL) {
347 this.node.setLine(this.cur_line, "p", prop.name);
348 this.addLine(this.pad + "public signal " + prop.rtype + " " + prop.name + " " + prop.val + ";");
350 this.ignore(prop.name);
354 GLib.debug("Got myvars: %s", prop.name.strip());
356 if (prop.rtype.strip().length < 1) {
360 // is it a class property...
361 if (cls.props.has_key(prop.name) && prop.ptype != NodePropType.USER) {
365 this.myvars.add(prop.name);
366 prop.start_line = this.cur_line;
368 this.node.setLine(this.cur_line, "p", prop.name);
370 this.addLine(this.pad + "public " + prop.rtype + " " + prop.name + ";"); // definer - does not include value.
373 prop.end_line = this.cur_line;
374 this.ignore(prop.name);
380 // if id of child is '+' then it's a property of this..
381 void addPlusProperties()
383 if (this.node.items.size < 1) {
386 var iter = this.node.items.list_iterator();
387 while (iter.next()) {
390 if (ci.xvala_id[0] != '+') {
391 continue; // skip generation of children?
395 this.addLine(this.pad + "public " + ci.xvala_xcls + " " + ci.xvala_id.substring(1) + ";");
401 * add the constructor definition..
413 this.addLine(this.pad + "// ctor");
415 if (this.node.has("* args")) {
416 // not sure what this is supposed to be ding..
418 cargs_str = this.node.get("* args");
419 //var ar = this.node.get("* args");.split(",");
420 //for (var ari =0; ari < ar.length; ari++) {
421 // cargs += (ar[ari].trim().split(" ").pop();
425 if (this.depth < 1) {
427 // top level - does not pass the top level element..
428 this.addLine(this.pad + "public " + this.xcls + "(" + cargs_str +")");
429 this.addLine(this.pad + "{");
431 if (cargs_str.length > 0) {
432 cargs_str = ", " + cargs_str;
434 // for sub classes = we passs the top level as _owner
435 this.addLine(this.pad + "public " + this.xcls + "(" + this.top.xcls + " _owner " + cargs_str + ")");
436 this.addLine(this.pad + "{");
442 * make sure _this is defined..
448 this.addLine( this.ipad + "_this = this;");
451 // for non top level = _this point to owner, and _this.ID is set
453 this.addLine( this.ipad + "_this = _owner;");
455 if (this.node.props.has_key("id")
457 this.node.xvala_id != ""
459 this.node.xvala_id[0] != '*'
461 this.node.xvala_id[0] != '+'
463 this.addLine( this.ipad + "_this." + node.xvala_id + " = this;");
469 * Initialize this.el to point to the wrapped element.
474 void addWrappedCtor()
477 // this may need to look up properties to fill in the arguments..
478 // introspection does not workk..... - as things like gtkmessagedialog
480 if (cls == 'Gtk.Table') {
482 var methods = this.palete.getPropertiesFor(cls, 'methods');
484 print(JSON.stringify(this.palete.proplist[cls], null,4));
489 // ctor can still override.
490 if (this.node.has("* ctor")) {
491 this.node.setLine(this.cur_line, "p", "* ctor");
492 this.addLine(this.ipad + "this.el = " + this.node.get("* ctor")+ ";");
496 this.node.setLine(this.cur_line, "p", "* xtype");;
498 // is the wrapped element a struct?
500 var ncls = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn());
501 if (ncls != null && ncls.nodetype == "Struct") {
502 // we can use regular setters to apply the values.
503 this.addLine(this.ipad + "this.el = " + this.node.fqn() + "();");
511 switch(this.node.fqn()) {
514 var is_entry = this.node.has("has_entry") && this.node.get_prop("has_entry").val.down() == "true";
516 break; // regular ctor.
518 this.ignoreWrapped("has_entry");
519 ctor = ".with_entry";
523 case "Gtk.ListStore":
524 case "Gtk.TreeStore":
526 // not sure if this works.. otherwise we have to go with varargs and count + vals...
527 if (this.node.has("* types")) {
528 args_str = this.node.get_prop("* types").val;
530 if (this.node.has("n_columns") && this.node.has("columns")) { // old value?
531 args_str = " { " + this.node.get_prop("columns").val + " } ";
532 this.ignoreWrapped("columns");
533 this.ignoreWrapped("n_columns");
536 this.addLine(this.ipad + "this.el = new " + this.node.fqn() + ".newv( " + args_str + " );");
540 case "Gtk.LinkButton": // args filled with values.
541 if (this.node.has("label")) {
542 ctor = ".with_label";
549 var default_ctor = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn() + ctor);
552 // use the default ctor - with arguments (from properties)
554 if (default_ctor != null && default_ctor.paramset != null && default_ctor.paramset.params.size > 0) {
556 var iter = default_ctor.paramset.params.list_iterator();
557 while (iter.next()) {
558 var n = iter.get().name;
559 GLib.debug("building CTOR ARGS: %s, %s", n, iter.get().is_varargs ? "VARARGS": "");
560 if (n == "___") { // for some reason our varargs are converted to '___' ...
564 if (!this.node.has(n)) { // node does not have a value
567 if (iter.get().type.contains("int")) {
571 if (iter.get().type.contains("float")) {
575 if (iter.get().type.contains("bool")) {
576 args += "true"; // always default to true?
579 // any other types???
584 this.ignoreWrapped(n);
587 var v = this.node.get(n);
589 if (iter.get().type == "string") {
590 v = "\"" + v.escape("") + "\"";
592 if (v == "TRUE" || v == "FALSE") {
600 this.node.setLine(this.cur_line, "p", "* xtype");
602 this.addLine(this.ipad + "this.el = new " + this.node.fqn() + "( "+ string.joinv(", ",args) + " );") ;
606 // default ctor with no params..
607 if (default_ctor != null && ctor != ".new" ) {
608 this.node.setLine(this.cur_line, "p", "* xtype");
610 this.addLine(this.ipad + "this.el = new " + this.node.fqn() + ctor + "( );") ;
615 this.addLine(this.ipad + "this.el = new " + this.node.fqn() + "(" + args_str + ");");
621 public static Gee.ArrayList<string> menuitem_children = null;
625 if (menuitem_children == null) {
626 menuitem_children = new Gee.ArrayList<string>();
627 menuitem_children.add("Gtk.MenuItem");
628 var gir = this.file.project.palete.getClass("Gtk.MenuItem");
629 foreach(var impl in gir.implementations) {
630 menuitem_children.add(impl);
634 if (menuitem_children.contains(this.node.fqn())) {
635 this.addLine(this.ipad + "this.el.show();");
642 //var meths = this.palete.getPropertiesFor(item['|xns'] + '.' + item.xtype, 'methods');
643 //print(JSON.stringify(meths,null,4));Seed.quit();
647 // initialize.. my vars..
649 this.addLine( this.ipad + "// my vars (dec)");
651 var iter = this.myvars.list_iterator();
657 var prop = this.node.props.get(k);
659 var v = prop.val.strip();
664 // at this point start using
666 if (v == "FALSE" || v == "TRUE") {
669 //FIXME -- check for raw string.. "string XXXX"
671 // if it's a string...
673 prop.start_line = this.cur_line;
674 this.addLine(this.ipad + "this." + prop.name + " = " + v +";");
675 prop.end_line = this.cur_line;
683 void addWrappedProperties()
685 var cls = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn());
687 GLib.debug("Skipping wrapped properties - could not find class %s" , this.node.fqn());
690 // what are the properties of this class???
692 this.addLine(this.ipad + "// set gobject values");
695 var iter = cls.props.map_iterator();
696 while (iter.next()) {
697 var p = iter.get_key();
698 //print("Check Write %s\n", p);
699 if (!this.node.has(p)) {
702 if (this.shouldIgnoreWrapped(p)) {
709 var prop = this.node.get_prop(p);
712 // user defined properties.
713 if (prop.ptype == NodePropType.USER) {
719 var is_raw = prop.ptype == NodePropType.RAW;
721 // what's the type.. - if it's a string.. then we quote it..
722 if (iter.get_value().type == "string" && !is_raw) {
723 v = "\"" + v.escape("") + "\"";
725 if (v == "TRUE" || v == "FALSE") {
728 if (iter.get_value().type == "float" && v[v.length-1] != 'f') {
732 prop.start_line = this.cur_line;
733 this.addLine("%sthis.el.%s = %s;".printf(ipad,p,v)); // // %s, iter.get_value().type);
734 prop.end_line = this.cur_line;
742 * pack the children into the parent.
744 * if the child's id starts with '*' then it is not packed...
745 * - this allows you to define children and add them manually..
751 if (this.node.items.size < 1) {
754 this.pane_number = 0;
755 var cols = this.node.has("* columns") ? int.parse(this.node.get_prop("* columns").val) : 1;
758 var iter = this.node.items.list_iterator();
760 while (iter.next()) {
763 var child = iter.get();
765 if (child.xvala_id[0] == '*') {
766 continue; // skip generation of children?
770 if (child.has("* args")) {
772 var ar = child.get_prop("* args").val.split(",");
773 for (var ari = 0 ; ari < ar.length; ari++ ) {
774 var arg = ar[ari].split(" ");
775 xargs += "," + arg[arg.length -1];
778 // create the element..
779 this.addLine(this.ipad + "var child_" + "%d".printf(i) + " = new " + child.xvala_xcls +
780 "( _this " + xargs + ");" );
782 // this is only needed if it does not have an ID???
785 if (child.has("* prop")) {
786 // fixme special packing!??!?!
787 if (child.get_prop("* prop").val.contains("[]")) {
788 // currently these 'child props
789 // used for label[] on Notebook
790 // used for button[] on Dialog?
792 this.packChild(child, i, 0, 0, child.get_prop("* prop").val); /// fixme - this is a bit speciall...
795 // add a ref... (if 'id' is not set... to a '+' ?? what does that mean? - fake ids?
796 if (child.xvala_id.length < 1 || child.xvala_id[0] != '+') {
797 this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
799 //this.addLine(this.ipad + "// no ref as xvala_id is %s".printf(child.xvala_id));
803 this.addLine(ipad + "this.el." + child.get_prop("* prop").val + " = child_" + "%d".printf(i) + ".el;");
807 if (child.xvala_id.length < 1 || child.xvala_id[0] != '+') {
808 this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
810 //this.addLine(this.ipad + "// no ref as xvala_id is %s".printf(child.xvala_id));
814 this.packChild(child, i, cols, colpos);
815 if (child.has("colspan")) {
816 colpos += int.parse(child.get_prop("colspan").val);
821 if (child.xvala_id[0] != '+') {
822 continue; // skip generation of children?
825 // this.{id - without the '+'} = the element...
826 this.addLine(this.ipad + "this." + child.xvala_id.substring(1) + " = child_" + "%d".printf(i) + ";");
833 void packChild(Node child, int i, int cols, int colpos, string propname= "")
836 GLib.debug("packChild %s=>%s", this.node.fqn(), child.fqn());
837 // forcing no packing? - true or false? -should we just accept false?
838 if (child.has("* pack") && child.get("* pack").down() == "false") {
839 return; // force no packing
841 if (child.has("* pack") && child.get("* pack").down() == "true") {
842 return; // force no packing
845 // BC really - don't want to support this anymore.
846 if (child.has("* pack")) {
848 string[] packing = { "add" };
849 if (child.has("* pack")) {
850 packing = child.get("* pack").split(",");
853 var pack = packing[0];
854 this.addLine(this.ipad + "this.el." + pack.strip() + " ( child_" + "%d".printf(i) + ".el " +
855 (packing.length > 1 ?
856 (", " + string.joinv(",", packing).substring(pack.length+1))
862 switch (this.node.fqn()) {
868 var x = child.has("x") ? child.get_prop("x").val : "0";
869 var y = child.has("y") ? child.get_prop("y").val : "0";
870 this.addLine(this.ipad + "this.el.put( child_%d.el, %s, %s );".printf(i,x,y) );
874 var x = "%d".printf(colpos % cols);
875 var y = "%d".printf(( colpos - (colpos % cols) ) / cols);
876 var w = child.has("colspan") ? child.get_prop("colspan").val : "1";
878 this.addLine(this.ipad + "this.el.attach( child_%d.el, %s, %s, %s, %s );".printf(i,x,y, w, h) );
882 var named = child.has("stack_name") ? child.get_prop("stack_name").val.escape() : "";
883 var title = child.has("stack_title") ? child.get_prop("stack_title").val.escape() : "";
884 if (title.length > 0) {
885 this.addLine(this.ipad + "this.el.add_titled( child_%d.el, \"%s\", \"%s\" );".printf(i,named,title));
887 this.addLine(this.ipad + "this.el.add_named( child_%d.el, \"%s\" );".printf(i,named));
891 case "Gtk.Notebook": // use label
892 var label = child.has("notebook_label") ? child.get_prop("notebook_label").val.escape() : "";
893 this.addLine(this.ipad + "this.el.append_page( child_%d.el, new Gtk.Label(\"%s\"));".printf(i, label));
897 case "Gtk.TreeView": // adding TreeViewColumns
898 this.addLine(this.ipad + "this.el.append_column( child_" + "%d".printf(i) + ".el );");
901 case "Gtk.TreeViewColumn": //adding Renderers - I think these are all proprerties of the renderer used...
902 if (child.has("markup_column") && int.parse(child.get_prop("markup_column").val) > -1) {
903 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"markup\", %s );".printf(i, child.get_prop("markup_column").val));
905 if (child.has("text_column") && int.parse(child.get_prop("text_column").val) > -1) {
906 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"text\", %s );".printf(i, child.get_prop("text_column").val));
908 if (child.has("pixbuf_column") && int.parse(child.get_prop("pixbuf_column").val) > -1) {
909 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"pixbuf\", %s );".printf(i, child.get_prop("pixbuf_column").val));
911 if (child.has("pixbuf_column") && int.parse(child.get_prop("active_column").val) > -1) {
912 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"active\", %s );".printf(i, child.get_prop("active_column").val));
914 if (child.has("background_column") && int.parse(child.get_prop("background_column").val) > -1) {
915 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"background-rgba\", %s );".printf(i, child.get_prop("background_column").val));
917 this.addLine(this.ipad + "this.el.add( child_" + "%d".printf(i) + ".el );");
922 if (propname == "buttons[]") {
924 if (child.has("* response_id")) {
925 resp_id = int.parse(child.get_prop("* response_id").val);
927 this.addLine(this.ipad + "this.el.add_action_widget( child_%d.el, %d);".printf(i,resp_id) );
932 this.addLine(this.ipad + "this.el.get_content_area().add( child_" + "%d".printf(i) + ".el );");
937 switch(this.pane_number) {
940 this.addLine(this.ipad + "this.el.pack%d( child_%d".printf(this.pane_number,i) + ".el );");
949 this.addLine(this.ipad + "this.el.append( child_" + "%d".printf(i) + ".el );");
953 this.addLine(this.ipad + "this.el.add( child_" + "%d".printf(i) + ".el );");
962 // fixme GtkDialog?!? buttons[]
964 // fixme ... add case "Gtk.RadioButton": // group_id ??
972 if (!this.node.has("* init")) {
976 this.addLine(ipad + "// init method");
978 this.node.setLine(this.cur_line, "p", "init");
980 var init = this.node.get_prop("* init");
981 init.start_line = this.cur_line;
982 this.addMultiLine(ipad + this.padMultiline(ipad, init.val) );
983 init.end_line = this.cur_line;
987 if (this.node.listeners.size < 1) {
992 this.addLine(ipad + "//listeners");
996 var iter = this.node.listeners.map_iterator();
997 while (iter.next()) {
998 var k = iter.get_key();
999 var prop = iter.get_value();
1002 prop.start_line = this.cur_line;
1003 this.node.setLine(this.cur_line, "l", k);
1004 this.addMultiLine(this.ipad + "this.el." + k + ".connect( " +
1005 this.padMultiline(this.ipad,v) +");");
1006 prop.end_line = this.cur_line;
1013 this.addLine(this.pad + "}");
1018 * Standardize this crap...
1020 * standard properties (use to set)
1021 * If they are long values show the dialog..
1024 * bool is_xxx :: can show a pulldown.. (true/false)
1026 * $ string html = string with value interpolated eg. baseURL + ".."
1027 * Clutter.ActorAlign x_align (typed) -- shows pulldowns if type is ENUM?
1028 * $ untypedvalue = javascript untyped value...
1029 * _ string html ... = translatable..
1032 * object properties (not part of the GOjbect being wrapped?
1033 * # Gee.ArrayList<Xcls_fileitem> fileitems
1038 * methods -- always text editor..
1046 * * init -- big string?
1048 * event handlers (listeners)
1053 * +XXXX -- indicates it's a instance property / not glob...
1054 * *XXXX -- skip writing glob property (used as classes that can be created...)
1059 void addUserMethods()
1062 this.addLine(this.pad + "// user defined functions");
1064 // user defined functions...
1065 var iter = this.node.props.map_iterator();
1066 while(iter.next()) {
1067 var prop = iter.get_value();
1068 if (this.shouldIgnore(prop.name)) {
1071 // HOW TO DETERIME if its a method?
1072 if (prop.ptype != NodePropType.METHOD) {
1073 //strbuilder("\n" + pad + "// skip " + k + " - not pipe \n");
1077 // function in the format of {type} (args) { .... }
1081 prop.start_line = this.cur_line;
1082 this.node.setLine(this.cur_line, "p", prop.name);
1083 this.addMultiLine(this.pad + "public " + prop.rtype + " " + prop.name + " " + this.padMultiline(this.pad, prop.val));;
1084 prop.end_line = this.cur_line;
1091 this.node.line_end = this.cur_line;
1092 this.node.sortLines();
1095 if (this.depth > 0) {
1096 this.addLine(this.inpad + "}");
1099 var iter = this.node.items.list_iterator();
1101 while (iter.next()) {
1102 this.addMultiLine(this.mungeChild(iter.get()));
1105 if (this.depth < 1) {
1106 this.addLine(this.inpad + "}");
1111 string padMultiline(string pad, string str)
1113 var ar = str.strip().split("\n");
1114 return string.joinv("\n" + pad , ar);
1117 void ignore(string i) {
1118 this.ignoreList.add(i);
1121 void ignoreWrapped(string i) {
1122 this.ignoreWrappedList.add(i);
1125 bool shouldIgnore(string i)
1127 return ignoreList.contains(i);
1129 bool shouldIgnoreWrapped(string i)
1131 return ignoreWrappedList.contains(i);