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