JSDOC/ScopeParser.vala
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.vala
index c260b0d..6f2136a 100644 (file)
@@ -3,6 +3,12 @@
 
 namespace JSDOC {
 
+       public enum ScopeParserMode {
+               BUILDING_SYMBOL_TREE,
+               PASS2_SYMBOL_TREE
+       }
+
+
        public class ScopeParser : Object {
        
        TokenStream ts;
@@ -12,17 +18,20 @@ namespace JSDOC {
        string[] idents;
        
        
-    //global : false,
-    //mode : "", //"BUILDING_SYMBOL_TREE",
+    Scope global ;
+    ScopeParserMode mode;
     //braceNesting : 0,
-    //indexedScopes : false,
-    //munge: true,
+    Gee.HashMap<int,Scope> indexedScopes;
+    bool munge =  true;
 
        
        
        public ScopeParser(TokenStream ts) {
                this.ts = ts; // {TokenStream}
                this.warnings = new Gee.ArrayList<string>();
+               this.globalScope = new  Scope(-1, false, -1, '');
+               this.indexedScopes = new Gee.HashMap<int,Scope>();
+               
                //this.indexedg = {};
                //this.timer = new Date() * 1;
                this.idents = { 
@@ -110,7 +119,7 @@ namespace JSDOC {
 
 
 
-    buildSymbolTree : function()
+    void buildSymbolTree()
     {
         //println("<PRE>");
         
@@ -121,15 +130,18 @@ namespace JSDOC {
         
         
         this.globalScope = new  Scope(-1, false, -1, '');
-        this.indexedScopes = { 0 : this.globalScope };
+        this.indexedScopes = new Gee.HashMap<int,Scope>();
+        this.indexedScopes.set(0, this.globalScope );
+        
+        this.mode = ScopeParserMode.BUILDING_SYMBOL_TREE;
         
-        this.mode = 'BUILDING_SYMBOL_TREE';
         this.parseScope(this.globalScope);
         
         //print("---------------END PASS 1 ---------------- ");
         
-    },
-    mungeSymboltree : function()
+    }
+    
+    void mungeSymboltree()
     {
 
         if (!this.munge) {
@@ -159,7 +171,7 @@ namespace JSDOC {
 
         this.ts.rewind();
         this.braceNesting = 0;
-        this.mode = 'PASS2_SYMBOL_TREE';
+        this.mode = PASS2_SYMBOL_TREE;
         
         //println("MUNGING?");