From 836136b4cae9210b533aed68da90e58a8e92a024 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 15 Sep 2015 17:21:23 +0800 Subject: [PATCH] JSDOC/TokenReader.vala --- JSDOC/TokenReader.vala | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/JSDOC/TokenReader.vala b/JSDOC/TokenReader.vala index dab8616..29deac8 100644 --- a/JSDOC/TokenReader.vala +++ b/JSDOC/TokenReader.vala @@ -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; + }, /** -- 2.39.2