X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FTokenReader.js;h=5e5cec89e2961724ecc74b338c978beb3ea957e8;hp=7d392812bf5f47a9e76f74519b96da324983bca5;hb=2aa12fecad9a0b4a25354b0a02496626561bf971;hpb=74b33e6c1909d1cfa283be42fd67b1c4a202f928 diff --git a/JSDOC/TokenReader.js b/JSDOC/TokenReader.js index 7d39281..5e5cec8 100644 --- a/JSDOC/TokenReader.js +++ b/JSDOC/TokenReader.js @@ -259,8 +259,7 @@ const TokenReader = XObject.define( found = "\n"; } if (this.keepWhite) { - //console.log(typeof(token)); - var last = tokens.pop(); + 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 }