X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FTokenReader.js;h=5e5cec89e2961724ecc74b338c978beb3ea957e8;hp=e8c86ec5523b6ac1db82ef28ff3b9d71469574fe;hb=2aa12fecad9a0b4a25354b0a02496626561bf971;hpb=e66f9d33358da0bc24c1aee179a58f1c69f9d177 diff --git a/JSDOC/TokenReader.js b/JSDOC/TokenReader.js index e8c86ec..5e5cec8 100644 --- a/JSDOC/TokenReader.js +++ b/JSDOC/TokenReader.js @@ -63,7 +63,6 @@ const TokenReader = XObject.define( if (this.read_regx(stream, tokens)) continue; if (this.read_numb(stream, tokens)) continue; if (this.read_punc(stream, tokens)) continue; - if(typeof(tokens) == 'undefined') {console.log('empty????');} if (this.read_newline(stream, tokens)) continue; if (this.read_space(stream, tokens)) continue; if (this.read_word(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 }