X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FTokenReader.js;h=5e5cec89e2961724ecc74b338c978beb3ea957e8;hp=a45bb0ad5a3d6b03b32f08b0b3c878a4a1e474d9;hb=2aa12fecad9a0b4a25354b0a02496626561bf971;hpb=e1b2ee18a5135507483eec649299cdf8d006d8d6;ds=sidebyside diff --git a/JSDOC/TokenReader.js b/JSDOC/TokenReader.js index a45bb0a..5e5cec8 100644 --- a/JSDOC/TokenReader.js +++ b/JSDOC/TokenReader.js @@ -56,7 +56,6 @@ const TokenReader = XObject.define( } while (!stream.look().eof) { - print_r(tokens); if (this.read_mlcomment(stream, tokens)) continue; if (this.read_slcomment(stream, tokens)) continue; if (this.read_dbquote(stream, tokens)) continue; @@ -259,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); } @@ -465,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())) { @@ -480,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 }