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