Changed roojspacker/DocTag.vala
authorAlan <alan@roojs.com>
Thu, 3 Mar 2022 08:56:23 +0000 (16:56 +0800)
committerAlan <alan@roojs.com>
Thu, 3 Mar 2022 08:56:23 +0000 (16:56 +0800)
roojspacker/DocTag.vala

index df050d7..c1d5afe 100644 (file)
@@ -125,7 +125,7 @@ namespace JSDOC
                 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);
                 }
             }
@@ -139,9 +139,15 @@ namespace JSDOC
             // 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);
@@ -151,15 +157,18 @@ namespace JSDOC
                                if (ms.contains("|")) {
                                        var ar = ms.split("|");
                                        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);                   
-                    
+                    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