From 350c3fa1ffc8d4ef0e847bc00a68048463e32779 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 19 Apr 2010 12:52:23 +0800 Subject: [PATCH] JSDOC/CompressWhite.js --- JSDOC/CompressWhite.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/JSDOC/CompressWhite.js b/JSDOC/CompressWhite.js index 22b99e6..eba5957 100644 --- a/JSDOC/CompressWhite.js +++ b/JSDOC/CompressWhite.js @@ -4,9 +4,11 @@ * pack a javascript file, and return a shorter version! * * a bit picky at present with ; and crlf reading... - * + * @arg ts {TokenStream} + @arg packer {Packer} */ -JSDOC.CompressWhite = function (ts, packer) + +CompressWhite = function (ts, packer) { ts.rewind(); @@ -18,7 +20,7 @@ JSDOC.CompressWhite = function (ts, packer) if (!tok) { break; } - if (tok._isWS) { + if (tok.type == "WHIT") { continue; //if (tok._isDoc) { // continue; @@ -32,11 +34,11 @@ JSDOC.CompressWhite = function (ts, packer) } // add semi-colon's where linebreaks are used... - not foolproof yet.! - if (tok.isTypeN(Script.TOKidentifier)) { + if (tok.type == "NAME")) { //var tokident = ts.look(-1).data + tok.data + ts.look(1).data + ts.look(2).data; // a = new function() {} - if (ts.look(1).isTypeN(Script.TOKassign) && ts.look(2).isTypeN(Script.TOKnew) && - ts.look(3).isTypeN(Script.TOKfunction)) { + if (ts.lookTok(1).data == '=' && ts.lookTok(2).name == 'NEW' && + ts.look(3).name == 'FUNCTION') { // freeze time.. var cu = ts.cursor; -- 2.39.2