MEMBEROF,
PUBLIC,
SCOPE,
- SCOPEALIAS
+ SCOPEALIAS,
+
+ // these are some we have added for creating trees etc..
+ CHILDREN, // what classes can be added as child in a tree
+ PARENT, // restrict what the class can be added to.
+ ABSTRACT, // is the class abstract
+ BUILDER_TOP // can the element be used as a top level in the gui builder
+
}
);
}
-
-
+ public Json.Object toJson()
+ {
+ var ret = new Json.Object();
+ ret.set_string_member("title", this.title.to_string());
+ ret.set_string_member("type", this.type);
+ ret.set_string_member("name", this.name);
+ ret.set_string_member("defaultValue", this.defaultValue);
+ ret.set_string_member("desc", this.desc);
+ ret.set_string_member("memberOf", this.memberOf);
+ ret.set_boolean_member("isOptional", this.isOptional);
+ var ar = new Json.Array();
+ foreach(var ov in this.optvalues) {
+ ar.add_string_element(ov);
+ }
+ ret.set_array_member("optvalues", ar);
+ return ret;
+ }
public DocTag (string in_src)
if (
this.title == DocTagTitle.PARAM ||
this.title == DocTagTitle.PROPERTY ||
- this.title == DocTagTitle.CFG) { // @config is deprecated
+ this.title == DocTagTitle.CFG) { // @config is deprecated << not really?
src = this.nibbleName(src);
}
}
// if type == @cfg, and matches (|....|...)
src = src.strip();
+
+ // our code uses (Optional) - but we really want to ignore this.
+ src = /\(Optional\)/.replace(src, src.length, 0, "").strip();
+
MatchInfo mi = null;
+
+
if (this.title == DocTagTitle.CFG && /^\([^)]+\)/.match_all(src, 0, out mi )) {
+
var ms = mi.fetch(0);
+ GLib.debug("Got Opt list: %s", ms);
+
ms = ms.substring(1,ms.length-2);
+ GLib.debug("clan to: %s", ms);
if (ms.contains("|")) {
var ar = ms.split("|");
+ GLib.debug("split to: %d", ar.length);
for (var i =0 ; i < ar.length;i++) {
- optvalues.add(ar[i].strip());
+ GLib.debug("Add optvalue: %s",ar[i].strip());
+ this.optvalues.add(ar[i].strip());
}
- src = src.substring(ms.length, src.length - ms.length);
-
+ src = src.substring(ms.length, src.length - (ms.length+2)).strip();
+ GLib.debug("SRC NOW: %s",src);
}
}
-
-
+ if (this.title == DocTagTitle.CFG && /\[required\]/.match(src)) {
+ this.isOptional = false;
+ src = /\[required\]/.replace(src, src.length, 0, "").strip();
+ }
this.desc = src; // whatever is left
// example tags need to have whitespace preserved
return src;
}
- //GLib.debug("nibbleTitle: regexmatches %d : %s",
- // mi.get_match_count(),
- // mi.fetch(1).up());
+ // convert the @xxx to a DocTagTitle
+ // wonder if caching this as a GeeHashmap would be quicker?
EnumClass enumc = (EnumClass) typeof (DocTagTitle).class_ref ();
- unowned EnumValue? eval = enumc.get_value_by_name ( "JSDOC_DOC_TAG_TITLE_"+ mi.fetch(1).up());
+ unowned EnumValue? eval = enumc.get_value_by_name(
+ // "JSDOC_DOC_TAG_TITLE_"+ mi.fetch(1).up()
+ "JSDOC_DOC_TAG_TITLE_"+ mi.fetch(1).up().replace("-", "_")
+ );
if (eval == null) {
throw new DocTagException.INVALID_TITLE("title not supported ??");
return src;
}
+ public Json.Object toPropertyJSON (Symbol parent)
+ {
+
+ var add = new Json.Object();
+ add.set_string_member("name",this.name);
+ add.set_string_member("type",this.type);
+ add.set_string_member("desc",this.desc);
+ add.set_string_member("memberOf", this.memberOf == parent.alias ? "" : this.memberOf);
+ add.set_boolean_member("isOptional", this.isOptional);
+ var ar = new Json.Array();
+ foreach(var ov in this.optvalues) {
+ ar.add_string_element(ov);
+ }
+ add.set_array_member("optvalues", ar);
+
+ return add;
+ }
+
}
}