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 != null && 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");
630 foreach(var impl in gir.implementations) {
631 menuitem_children.add(impl);
636 if (menuitem_children.contains(this.node.fqn())) {
637 this.addLine(this.ipad + "this.el.show();");
644 //var meths = this.palete.getPropertiesFor(item['|xns'] + '.' + item.xtype, 'methods');
645 //print(JSON.stringify(meths,null,4));Seed.quit();
649 // initialize.. my vars..
651 this.addLine( this.ipad + "// my vars (dec)");
653 var iter = this.myvars.list_iterator();
659 var prop = this.node.props.get(k);
661 var v = prop.val.strip();
666 // at this point start using
668 if (v == "FALSE" || v == "TRUE") {
671 //FIXME -- check for raw string.. "string XXXX"
673 // if it's a string...
675 prop.start_line = this.cur_line;
676 this.addLine(this.ipad + "this." + prop.name + " = " + v +";");
677 prop.end_line = this.cur_line;
685 void addWrappedProperties()
687 var cls = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn());
689 GLib.debug("Skipping wrapped properties - could not find class %s" , this.node.fqn());
692 // what are the properties of this class???
694 this.addLine(this.ipad + "// set gobject values");
697 var iter = cls.props.map_iterator();
698 while (iter.next()) {
699 var p = iter.get_key();
700 //print("Check Write %s\n", p);
701 if (!this.node.has(p)) {
704 if (this.shouldIgnoreWrapped(p)) {
711 var prop = this.node.get_prop(p);
714 // user defined properties.
715 if (prop.ptype == NodePropType.USER) {
721 var is_raw = prop.ptype == NodePropType.RAW;
723 // what's the type.. - if it's a string.. then we quote it..
724 if (iter.get_value().type == "string" && !is_raw) {
725 v = "\"" + v.escape("") + "\"";
727 if (v == "TRUE" || v == "FALSE") {
730 if (iter.get_value().type == "float" && v[v.length-1] != 'f') {
734 prop.start_line = this.cur_line;
735 this.addLine("%sthis.el.%s = %s;".printf(ipad,p,v)); // // %s, iter.get_value().type);
736 prop.end_line = this.cur_line;
744 * pack the children into the parent.
746 * if the child's id starts with '*' then it is not packed...
747 * - this allows you to define children and add them manually..
753 if (this.node.items.size < 1) {
756 this.pane_number = 0;
757 var cols = this.node.has("* columns") ? int.parse(this.node.get_prop("* columns").val) : 1;
760 var iter = this.node.items.list_iterator();
762 while (iter.next()) {
765 var child = iter.get();
767 if (child.xvala_id[0] == '*') {
768 continue; // skip generation of children?
772 if (child.has("* args")) {
774 var ar = child.get_prop("* args").val.split(",");
775 for (var ari = 0 ; ari < ar.length; ari++ ) {
776 var arg = ar[ari].split(" ");
777 xargs += "," + arg[arg.length -1];
780 // create the element..
781 this.addLine(this.ipad + "var child_" + "%d".printf(i) + " = new " + child.xvala_xcls +
782 "( _this " + xargs + ");" );
784 // this is only needed if it does not have an ID???
787 if (child.has("* prop")) {
788 // fixme special packing!??!?!
789 if (child.get_prop("* prop").val.contains("[]")) {
790 // currently these 'child props
791 // used for label[] on Notebook
792 // used for button[] on Dialog?
794 this.packChild(child, i, 0, 0, child.get_prop("* prop").val); /// fixme - this is a bit speciall...
797 // add a ref... (if 'id' is not set... to a '+' ?? what does that mean? - fake ids?
798 if (child.xvala_id.length < 1 || child.xvala_id[0] != '+') {
799 this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
801 //this.addLine(this.ipad + "// no ref as xvala_id is %s".printf(child.xvala_id));
805 this.addLine(ipad + "this.el." + child.get_prop("* prop").val + " = child_" + "%d".printf(i) + ".el;");
809 if (child.xvala_id.length < 1 || child.xvala_id[0] != '+') {
810 this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
812 //this.addLine(this.ipad + "// no ref as xvala_id is %s".printf(child.xvala_id));
816 this.packChild(child, i, cols, colpos);
817 if (child.has("colspan")) {
818 colpos += int.parse(child.get_prop("colspan").val);
823 if (child.xvala_id[0] != '+') {
824 continue; // skip generation of children?
827 // this.{id - without the '+'} = the element...
828 this.addLine(this.ipad + "this." + child.xvala_id.substring(1) + " = child_" + "%d".printf(i) + ";");
835 void packChild(Node child, int i, int cols, int colpos, string propname= "")
838 GLib.debug("packChild %s=>%s", this.node.fqn(), child.fqn());
839 // forcing no packing? - true or false? -should we just accept false?
840 if (child.has("* pack") && child.get("* pack").down() == "false") {
841 return; // force no packing
843 if (child.has("* pack") && child.get("* pack").down() == "true") {
844 return; // force no packing
847 // BC really - don't want to support this anymore.
848 if (child.has("* pack")) {
850 string[] packing = { "add" };
851 if (child.has("* pack")) {
852 packing = child.get("* pack").split(",");
855 var pack = packing[0];
856 this.addLine(this.ipad + "this.el." + pack.strip() + " ( child_" + "%d".printf(i) + ".el " +
857 (packing.length > 1 ?
858 (", " + string.joinv(",", packing).substring(pack.length+1))
864 var childcls = this.file.project.palete.getClass(child.fqn()); // very trusting..
865 var is_event = childcls.inherits.contains("Gtk.EventController") || childcls.implements.contains("Gtk.EventController");
867 this.addLine(this.ipad + "this.el.add_controller( child_%d.el );".printf(i) );
872 switch (this.node.fqn()) {
878 var x = child.has("x") ? child.get_prop("x").val : "0";
879 var y = child.has("y") ? child.get_prop("y").val : "0";
880 this.addLine(this.ipad + "this.el.put( child_%d.el, %s, %s );".printf(i,x,y) );
884 var x = "%d".printf(colpos % cols);
885 var y = "%d".printf(( colpos - (colpos % cols) ) / cols);
886 var w = child.has("colspan") ? child.get_prop("colspan").val : "1";
888 this.addLine(this.ipad + "this.el.attach( child_%d.el, %s, %s, %s, %s );".printf(i,x,y, w, h) );
892 var named = child.has("stack_name") ? child.get_prop("stack_name").val.escape() : "";
893 var title = child.has("stack_title") ? child.get_prop("stack_title").val.escape() : "";
894 if (title.length > 0) {
895 this.addLine(this.ipad + "this.el.add_titled( child_%d.el, \"%s\", \"%s\" );".printf(i,named,title));
897 this.addLine(this.ipad + "this.el.add_named( child_%d.el, \"%s\" );".printf(i,named));
901 case "Gtk.Notebook": // use label
902 var label = child.has("notebook_label") ? child.get_prop("notebook_label").val.escape() : "";
903 this.addLine(this.ipad + "this.el.append_page( child_%d.el, new Gtk.Label(\"%s\"));".printf(i, label));
907 case "Gtk.TreeView": // adding TreeViewColumns
908 this.addLine(this.ipad + "this.el.append_column( child_" + "%d".printf(i) + ".el );");
911 case "Gtk.TreeViewColumn": //adding Renderers - I think these are all proprerties of the renderer used...
912 if (child.has("markup_column") && int.parse(child.get_prop("markup_column").val) > -1) {
913 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"markup\", %s );".printf(i, child.get_prop("markup_column").val));
915 if (child.has("text_column") && int.parse(child.get_prop("text_column").val) > -1) {
916 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"text\", %s );".printf(i, child.get_prop("text_column").val));
918 if (child.has("pixbuf_column") && int.parse(child.get_prop("pixbuf_column").val) > -1) {
919 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"pixbuf\", %s );".printf(i, child.get_prop("pixbuf_column").val));
921 if (child.has("pixbuf_column") && int.parse(child.get_prop("active_column").val) > -1) {
922 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"active\", %s );".printf(i, child.get_prop("active_column").val));
924 if (child.has("background_column") && int.parse(child.get_prop("background_column").val) > -1) {
925 this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"background-rgba\", %s );".printf(i, child.get_prop("background_column").val));
927 this.addLine(this.ipad + "this.el.add( child_" + "%d".printf(i) + ".el );");
932 if (propname == "buttons[]") {
934 if (child.has("* response_id")) {
935 resp_id = int.parse(child.get_prop("* response_id").val);
937 this.addLine(this.ipad + "this.el.add_action_widget( child_%d.el, %d);".printf(i,resp_id) );
942 this.addLine(this.ipad + "this.el.get_content_area().add( child_" + "%d".printf(i) + ".el );");
947 switch(this.pane_number) {
950 this.addLine(this.ipad + "this.el.pack%d( child_%d".printf(this.pane_number,i) + ".el );");
959 this.addLine(this.ipad + "this.el.append( child_" + "%d".printf(i) + ".el );");
963 // gtk4 uses append!!!! - gtk3 - uses add..
964 this.addLine(this.ipad + "this.el.append( child_" + "%d".printf(i) + ".el );");
973 // fixme GtkDialog?!? buttons[]
975 // fixme ... add case "Gtk.RadioButton": // group_id ??
983 if (!this.node.has("* init")) {
987 this.addLine(ipad + "// init method");
989 this.node.setLine(this.cur_line, "p", "init");
991 var init = this.node.get_prop("* init");
992 init.start_line = this.cur_line;
993 this.addMultiLine(ipad + this.padMultiline(ipad, init.val) );
994 init.end_line = this.cur_line;
998 if (this.node.listeners.size < 1) {
1003 this.addLine(ipad + "//listeners");
1007 var iter = this.node.listeners.map_iterator();
1008 while (iter.next()) {
1009 var k = iter.get_key();
1010 var prop = iter.get_value();
1013 prop.start_line = this.cur_line;
1014 this.node.setLine(this.cur_line, "l", k);
1015 this.addMultiLine(this.ipad + "this.el." + k + ".connect( " +
1016 this.padMultiline(this.ipad,v) +");");
1017 prop.end_line = this.cur_line;
1024 this.addLine(this.pad + "}");
1029 * Standardize this crap...
1031 * standard properties (use to set)
1032 * If they are long values show the dialog..
1035 * bool is_xxx :: can show a pulldown.. (true/false)
1037 * $ string html = string with value interpolated eg. baseURL + ".."
1038 * Clutter.ActorAlign x_align (typed) -- shows pulldowns if type is ENUM?
1039 * $ untypedvalue = javascript untyped value...
1040 * _ string html ... = translatable..
1043 * object properties (not part of the GOjbect being wrapped?
1044 * # Gee.ArrayList<Xcls_fileitem> fileitems
1049 * methods -- always text editor..
1057 * * init -- big string?
1059 * event handlers (listeners)
1064 * +XXXX -- indicates it's a instance property / not glob...
1065 * *XXXX -- skip writing glob property (used as classes that can be created...)
1070 void addUserMethods()
1073 this.addLine(this.pad + "// user defined functions");
1075 // user defined functions...
1076 var iter = this.node.props.map_iterator();
1077 while(iter.next()) {
1078 var prop = iter.get_value();
1079 if (this.shouldIgnore(prop.name)) {
1082 // HOW TO DETERIME if its a method?
1083 if (prop.ptype != NodePropType.METHOD) {
1084 //strbuilder("\n" + pad + "// skip " + k + " - not pipe \n");
1088 // function in the format of {type} (args) { .... }
1092 prop.start_line = this.cur_line;
1093 this.node.setLine(this.cur_line, "p", prop.name);
1094 this.addMultiLine(this.pad + "public " + prop.rtype + " " + prop.name + " " + this.padMultiline(this.pad, prop.val));;
1095 prop.end_line = this.cur_line;
1102 this.node.line_end = this.cur_line;
1103 this.node.sortLines();
1106 if (this.depth > 0) {
1107 this.addLine(this.inpad + "}");
1110 var iter = this.node.items.list_iterator();
1112 while (iter.next()) {
1113 this.addMultiLine(this.mungeChild(iter.get()));
1116 if (this.depth < 1) {
1117 this.addLine(this.inpad + "}");
1122 string padMultiline(string pad, string str)
1124 var ar = str.strip().split("\n");
1125 return string.joinv("\n" + pad , ar);
1128 void ignore(string i) {
1129 this.ignoreList.add(i);
1132 void ignoreWrapped(string i) {
1133 this.ignoreWrappedList.add(i);
1136 bool shouldIgnore(string i)
1138 return ignoreList.contains(i);
1140 bool shouldIgnoreWrapped(string i)
1142 return ignoreWrappedList.contains(i);