X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FTokenReader.js;h=5e5cec89e2961724ecc74b338c978beb3ea957e8;hp=bd67ad8117a69712430e262192c1bc0a1af4aa72;hb=2aa12fecad9a0b4a25354b0a02496626561bf971;hpb=18cbb4d171b18a727e5b782a0b5fd69e1baadbd3 diff --git a/JSDOC/TokenReader.js b/JSDOC/TokenReader.js index bd67ad8..5e5cec8 100644 --- a/JSDOC/TokenReader.js +++ b/JSDOC/TokenReader.js @@ -54,7 +54,7 @@ const TokenReader = XObject.define( } return true; } - Options.LOG.inform("tokens : " + tokens); + while (!stream.look().eof) { if (this.read_mlcomment(stream, tokens)) continue; if (this.read_slcomment(stream, tokens)) continue; @@ -258,8 +258,8 @@ const TokenReader = XObject.define( if (this.collapseWhite) { found = "\n"; } - if (this.keepWhite) { - var last = tokens.pop(); + if (this.keepWhite) { + var last = tokens ? tokens.pop() : false; if (last && last.name != "WHIT") { tokens.push(last); } @@ -464,12 +464,25 @@ const TokenReader = XObject.define( ) ) { var regex = stream.next(); - + var unbrace = false; while (!stream.look().eof) { + + if (stream.look() == "[") { // escape sequence + in_brace = true; + continue; + } + + if (in_brace && stream.look() == "[") { // escape sequence + in_brace = true; + continue; + } + if (stream.look() == "\\") { // escape sequence regex += stream.next(2); + continue; } - else if (stream.look() == "/") { + + if (!in_brace && stream.look() == "/") { regex += stream.next(); while (/[gmi]/.test(stream.look())) { @@ -479,9 +492,9 @@ const TokenReader = XObject.define( tokens.push(new Token(regex, "REGX", "REGX", this.line)); return true; } - else { - regex += stream.next(); - } + + regex += stream.next(); + } // error: unterminated regex }