JSDOC/TokenReader.vala
authorAlan Knowles <alan@roojs.com>
Tue, 15 Sep 2015 09:21:23 +0000 (17:21 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 15 Sep 2015 09:21:23 +0000 (17:21 +0800)
JSDOC/TokenReader.vala

index dab8616..29deac8 100644 (file)
@@ -347,23 +347,34 @@ namespace JSDOC {
         /**
             @returns {Boolean} Was the token found?
          */
-        read_mlcomment : function(/**JSDOC.TokenStream*/stream, tokens) {
-            if (stream.look() == "/" && stream.look(1) == "*") {
-                var found = stream.next(2);
-                var c = '';
-                var line = this.line;
-                while (!stream.look().eof && !(stream.look(-1) == "/" && stream.look(-2) == "*")) {
-                    c = stream.next();
-                    if (c == "\n") this.line++;
-                    found += c;
+        public bool read_mlcomment  (TokenStream stream, TokenArray tokens)
+        {
+            if (stream.look() != "/") {
+                return false;
+            }
+            if (stream.look(1) != "*") {
+                return false;
+            }
+            var found = stream.next(2);
+            var c = '';
+            var line = this.line;
+            while (!stream.lookEOF() && !(stream.look(-1) == "/" && stream.look(-2) == "*")) {
+                c = stream.next();
+                if (c == "\n") {
+                    this.line++;
                 }
-                
-                // to start doclet we allow /** or /*** but not /**/ or /****
-                if (/^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) tokens.push(new Token(found, "COMM", "JSDOC", this.line));
-                else if (this.keepComments) tokens.push(new Token(found, "COMM", "MULTI_LINE_COMM", line));
-                return true;
+                found += c;
             }
-            return false;
+            
+            // to start doclet we allow /** or /*** but not /**/ or /****
+            //if (found.length /^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) {
+            if ((this.keepDocs && found.length > 4 && found.index_of("/**") == 0 && found[3] != "/") {
+                tokens.push(new Token(found, "COMM", "JSDOC", this.line));
+            } else if (this.keepComments) {
+                tokens.push(new Token(found, "COMM", "MULTI_LINE_COMM", line));
+            }
+            return true;
+        
         },
 
         /**