From: Alan Knowles Date: Tue, 10 Aug 2010 02:33:27 +0000 (+0800) Subject: JSDOC/TokenReader.js X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=commitdiff_plain;h=ab02fc2fb5b6705a01f26d25b50937780bc0dd73 JSDOC/TokenReader.js --- diff --git a/JSDOC/TokenReader.js b/JSDOC/TokenReader.js index e367849..41513a1 100644 --- a/JSDOC/TokenReader.js +++ b/JSDOC/TokenReader.js @@ -40,8 +40,10 @@ TokenReader = XObject.define( tokenize : function(/**JSDOC.TextStream*/stream) { this.line =1; var tokens = []; - /**@ignore*/ tokens.last = function() { return tokens[tokens.length-1]; } - /**@ignore*/ tokens.lastSym = function() { + /**@ignore*/ + tokens.last = function() { return tokens[tokens.length-1]; } + /**@ignore*/ + tokens.lastSym = function() { for (var i = tokens.length-1; i >= 0; i--) { if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i]; } @@ -115,13 +117,23 @@ TokenReader = XObject.define( found += stream.next(); } + if (found === "") { return false; } - else { - tokens.push(new Token(found, "PUNC", Lang.punc(found), this.line)); - return true; + + if ((found == '}' || found == ']') && tokens.lastSym().data == ',') { + //print("Error - comma found before " + found); + //print(JSON.stringify(tokens.lastSym(), null,4)); + throw { + name : "ArgumentError", + message: "Error - comma found before " + found + " on line " + this.line + "\n" + } } + + tokens.push(new Token(found, "PUNC", Lang.punc(found), this.line)); + return true; + }, /**