config1.builder
[gnome.introspection-doc-generator] / JSDOC / Collapse.vala
index 8d1d5b8..30cefb3 100644 (file)
@@ -85,11 +85,12 @@ namespace JSDOC {
             
             while (true) {
                 var  tok = st.look(1,true);
-                if (!tok || !tok.is) {
+                if (tok == null) {
                   //  Seed.print(TokenStream.toString(ret));
                     return ret;
                 }
                 // console.log(tok.data);
+                
                 switch(tok.type) {
                     case "VOID": 
                         return ret; //EOF
@@ -113,39 +114,41 @@ namespace JSDOC {
                                 var start = st.cursor;
                                 st.next(1);
                                 var add = st.balance(tok.data);
-                                if (!add) {
-                                    console.dump(tok);
-                                    console.dump(start + '...' + st.cursor);
-                                    console.dump(st.tokens);
+                               // if (!add) {
+                                    //console.dump(tok);
+                                    //console.dump(start + '...' + st.cursor);
+                                    //console.dump(st.tokens);
                                  
-                                }
-                                if (add) {
-                                    add.shift();
+                                //}
+                                if (add.size > 0) {
+                                               add.remove_at(0);  // remove the first element... (as it's the 
                                 }
                                 //Seed.print("ADD");
                                 //Seed.print(JSON.stringify(add, null,4));
                                 
                                 
                                 
-                                var toks = add ? this.collapse(add) : [];
-                                tok.items = false;
-                                tok.props = false;
-                                
+                                var toks = add.size > 0 ? this.collapse(add) : add;
                                 
+                                tok.items = new Gee.ArrayList<Token>(); //?? needed?
+                                tok.props = new Gee.HashMap<string,Gee.ArrayList<Token>>();
+                                 
                                 
-                                if (tok.data != '{') {
+                                if (tok.data != "{") {
                                     // paramters or array elements..
-                                    tok.items = this.toItems(toks, [',']);
+                                    tok.items = this.toItems(toks, ","]);
                                 } else {
                                     // check for types.. it could be a list of statements.. or object
+                                    // format "{" "xXXX" ":" << looks for the ':'.. seems to work.. not sure if it's foolproof...
                                     
                                     var ost = new  TokenStream(toks);
                                     //console.dump(ost.look(2,true) );
                                     if (ost.look(2,true) && ost.look(2,true).data == ":") {
+                                               // object properties...
                                         tok.props = this.toProps(toks);
                                     } else {
                                         // list of statemetns..
-                                        tok.items = this.toItems(toks,[ ';', '{'] );;
+                                        tok.items = this.toItems(toks, ";{");;
                                     }