c550d7adbb5722747b1bb6aa21decbd736151c29
[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             print("invalid file format");
58             Seed.quit();
59             
60             //GtkFile.superclass.parse.call(this);
61             
62             
63             
64             
65             
66              
67             
68             
69                 
70         },
71         
72         parseImports : function()
73         {
74            // console.dump(this.tokens);
75             this.giImports = [];
76             while (true) {
77                 var pos = this.lookFor('=');
78                 if (pos < 0)  {
79                     break;
80                 }
81                 this.cursor = pos;
82                 var k = this.look(-1, true);
83                 var v = this.look(1, true);
84                // Seed.print(k.data + " => " + v.data);
85                
86                 /// finish!!! - not an import ...
87                
88                 if (!v.data.match(/^imports/)) {
89                     return; ///
90                     
91                     this.cursor++;
92                     continue;
93                 }
94                 if (v.data.match(/^imports\.gi/)) {
95                     // gi import..
96                     this.giImports.push(v.data.replace(/imports\.gi\./, ''));
97                     
98                     this.cursor++;
99                     continue;
100                 }
101                   
102                 // two types of import left
103                 // imports.xnew
104                 if (v.data.match(/^imports\./)) {
105                     this.imports[k.data] = v.data.replace(/imports\./, '') + '.js';
106                     this.cursor++;
107                     continue;
108                 }
109                 // imports[.....]
110                 this.cursor++;
111                 if (this.lookFor('[') > this.lookFor('=')) {
112                     continue;
113                 }
114                 var bpos = this.lookFor('[');
115                // console.dump(this.tokens[bpos]);
116                 
117                 this.imports[k.data] = this.tokens[bpos].items[0][0].toJS();
118                 
119                 this.cursor++;
120                 
121             }
122         //    console.dump(this.giImports);
123           //  console.dump(this.imports);
124             //Seed.quit();
125             
126         }
127         
128 });
129