JSDOC/Packer.js
authoralan <alan@alanfast.akbkhome.com>
Wed, 21 Apr 2010 05:47:01 +0000 (13:47 +0800)
committeralan <alan@alanfast.akbkhome.com>
Wed, 21 Apr 2010 05:47:01 +0000 (13:47 +0800)
JSDOC/Packer.js

index 3155df3..8f7edff 100644 (file)
@@ -251,15 +251,15 @@ Packer.prototype = {
     pack : function (str,fn,minfile)
     {
     
-        var tr = new  TokenReader();
+        var tr = new  TokenReader(  { keepDocs :true, keepWhite : true,  keepComments : true, sepIdents : true });
         this.timerPrint("START" + fn);
         
         // we can load translation map here...
         
-        var toks = tr.tokenize(str,false); // dont merge xxx + . + yyyy etc.
+        var toks = tr.tokenize(new TextStream(str)); // dont merge xxx + . + yyyy etc.
         
         // at this point we can write a language file...
-        if (this.translate) {
+        if (this.translateJson) {
             this.writeTranslateFile(fn, minfile, tr.translateMap);
         }
         
@@ -267,12 +267,9 @@ Packer.prototype = {
         
         // and replace if we are generating a different language..
         
-        
-        
-        
         this.timerPrint("Tokenized");
         //return;//
-        var sp = new ScopeParser(new TokenStream(toks, str.length));
+        var sp = new ScopeParser(new TokenStream(toks));
         this.timerPrint("Converted to Parser");
         sp.packer = this;
         sp.buildSymbolTree();
@@ -284,6 +281,19 @@ Packer.prototype = {
         this.timerPrint("Compressed");
         return out;
         
+        
+        
+     
+    var ts = new   TokenStream(toks);
+   // ts.dump();
+    var sp = new  ScopeParser(ts);
+    sp.buildSymbolTree();
+    sp.mungeSymboltree();
+    print(sp.warnings.join("\n"));
+    var out =  CompressWhite(sp.ts);
+    return out;
+        
+        
     },
     
     timerPrint: function (str) {