X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FTokenReader.js;h=c38e13b2b70c1260568277e6ca7fa65ae54bbd4c;hb=fe8b15c8053ee83103669ffcc032474ea41e6b38;hp=19b9d1bfda3daa276aeba44a92d812dd93023049;hpb=bf51508caec59dd942e6b92b8b344f249e163235;p=gnome.introspection-doc-generator diff --git a/JSDOC/TokenReader.js b/JSDOC/TokenReader.js index 19b9d1b..c38e13b 100644 --- a/JSDOC/TokenReader.js +++ b/JSDOC/TokenReader.js @@ -121,6 +121,7 @@ TokenReader = XObject.define( for (var i = n-1; i >= 0; i--) { if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i]; } + return null; }, @@ -150,10 +151,12 @@ TokenReader = XObject.define( var lt = this.lastSym(tokens, n); Seed.print(JSON.stringify(lt)); if (lt.type != 'KEYW' || ['IF', 'WHILE'].indexOf(lt.name) < -1) { - throw { - name : "ArgumentError", - message: "\n" + this.filename + ':' + this.line + " Error - return found after )" - } + if (!this.ignoreBadGrammer) { + throw { + name : "ArgumentError", + message: "\n" + this.filename + ':' + this.line + " Error - return found after )" + } + } } @@ -200,10 +203,15 @@ TokenReader = XObject.define( if ((found == '}' || found == ']') && tokens.lastSym().data == ',') { //print("Error - comma found before " + found); //print(JSON.stringify(tokens.lastSym(), null,4)); - throw { - name : "ArgumentError", - message: "\n" + this.filename + ':' + this.line + " Error - comma found before " + found - } + if (this.ignoreBadGrammer) { + print("\n" + this.filename + ':' + this.line + " Error - comma found before " + found); + } else { + + throw { + name : "ArgumentError", + message: "\n" + this.filename + ':' + this.line + " Error - comma found before " + found + } + } } tokens.push(new Token(found, "PUNC", Lang.punc(found), this.line));