JSDOC/BuildDocs.js
[gnome.introspection-doc-generator] / JSDOC / BuildDocs.js
index 7c962be..d11416a 100644 (file)
@@ -10,9 +10,9 @@ File = imports.File.File;
 
 Template = imports.JsTemplate.Template.Template;
 
-Options = imports.Options.Options;
-Parser   = imports.Parser.Parser;
 
+Parser   = imports.Parser.Parser;
+TextStream = imports.TextStream.TextStream;
 TokenReader = imports.TokenReader.TokenReader;
 TokenStream = imports.TokenStream.TokenStream;
 Symbol = imports.Symbol.Symbol;
@@ -21,7 +21,7 @@ Symbol = imports.Symbol.Symbol;
 // should not realy be here -- or anywhere...??
 
 
-
+Options = false; // refer to this everywhere!
 
 
 BuildDocs = {
@@ -31,15 +31,16 @@ BuildDocs = {
     
     srcFiles : [],
     
-    build : function ()
+    
+    build : function (opts)
     {
-         
+        Options = opts; 
         Options.init();
         
         Options.LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
         //Options.LOG.inform("With options: ");
         
-        if (!File.isDirectory(Options.cacheDirectory)) {   
+        if (Options.cacheDirectory.length && !File.isDirectory(Options.cacheDirectory)) {   
             File.mkdir(Options.cacheDirectory)
         }
         
@@ -121,6 +122,7 @@ BuildDocs = {
             
             var src = ''
             try {
+                Options.LOG.warn("reading : " + srcFile);
                 src = File.read(srcFile);
             }
             catch(e) {
@@ -128,9 +130,10 @@ BuildDocs = {
                 continue;
             }
 
-             
-            var tr = new TokenReader();
-            var ts = new TokenStream(tr.tokenize(src));
+            var txs = new TextStream(src);
+            
+            var tr = new TokenReader({ keepComments : true, keepWhite : true });
+            var ts = new TokenStream(txs);
         
             Parser.parse(ts, srcFile);
               
@@ -146,7 +149,7 @@ BuildDocs = {
         
         
         Parser.finish();
-    }
+    },
     
      
         
@@ -276,7 +279,7 @@ BuildDocs = {
         
     },
 
-    publishJSON = function(file, data)
+    publishJSON : function(file, data)
     {
         // what we need to output to be usefull...
         // a) props..