JSDOC/Walker2.js
[gnome.introspection-doc-generator] / JSDOC / GtkFile.js
1 //<script type="text/javscript">
2
3 XObject = imports.XObject.XObject;
4
5
6  
7 console = imports.console.console; 
8
9 // make sure parent is loaded..
10 RooFile = imports.RooFile..RooFile;
11
12 /**
13  * 
14  * this takes our collased file, and turns it into the config array..
15  * 
16  * 
17  * 
18  * 
19  * 
20  * 
21  */
22
23
24
25 GtkFile  = XObject.define(
26     function (ar)
27     {
28         GtkFile.superclass.constructor.call(this, ar);
29        // console.log("STARTING OUTPUT");
30         
31         
32
33     }, 
34     RooFile, 
35     {
36         
37         cfg : { },
38         giImports : [],
39         imports : { }, 
40         parse: function()
41         {
42             // parse imports...
43             
44             this.parseImports();
45             // function create() { return;
46                 
47             var pos = this.lookFor( 'function');
48             
49             
50             // standard create format.
51             
52             if (pos  > -1 && this.tokens[pos+1].data == 'create') {
53                 var tree = this.tokens[pos+3].items[0][1].props;
54                 this.cfg= this.parseProps(tree);
55                 return;
56             }
57             GtkFile.superclass.parse.call(this);
58             
59             
60             
61             
62             
63              
64             
65             
66                 
67         },
68         
69         parseImports : function()
70         {
71            // console.dump(this.tokens);
72             this.giImports = [];
73             while (true) {
74                 var pos = this.lookFor('=');
75                 if (pos < 0)  {
76                     break;
77                 }
78                 this.cursor = pos;
79                 var k = this.look(-1, true);
80                 var v = this.look(1, true);
81                // Seed.print(k.data + " => " + v.data);
82                
83                 /// finish!!! - not an import ...
84                
85                 if (!v.data.match(/^imports/)) {
86                     return; ///
87                     
88                     this.cursor++;
89                     continue;
90                 }
91                 if (v.data.match(/^imports\.gi/)) {
92                     // gi import..
93                     this.giImports.push(v.data.replace(/imports\.gi\./, ''));
94                     
95                     this.cursor++;
96                     continue;
97                 }
98                   
99                 // two types of import left
100                 // imports.xnew
101                 if (v.data.match(/^imports\./)) {
102                     this.imports[k.data] = v.data.replace(/imports\./, '') + '.js';
103                     this.cursor++;
104                     continue;
105                 }
106                 // imports[.....]
107                 this.cursor++;
108                 if (this.lookFor('[') > this.lookFor('=')) {
109                     continue;
110                 }
111                 var bpos = this.lookFor('[');
112                // console.dump(this.tokens[bpos]);
113                 
114                 this.imports[k.data] = this.tokens[bpos].items[0][0].toJS();
115                 
116                 this.cursor++;
117                 
118             }
119         //    console.dump(this.giImports);
120           //  console.dump(this.imports);
121             //Seed.quit();
122             
123         }
124         
125 });
126