JSDOC/Packer.js
[gnome.introspection-doc-generator] / rconv.js
1 /**
2  *
3  * This is a test file to convert appbuilder style application code
4  *  into javascript structures.
5  *
6  *
7  * Needs to test a while directory convert to-><-from and compare..
8  *
9  *
10  */
11
12 var RooFile = imports.JSDOC.RooFile.RooFile;
13 var TokenReader = imports.JSDOC.TokenReader.TokenReader;
14 var TextStream = imports.JSDOC.TextStream.TextStream;
15
16 var File = imports.File.File;
17
18
19
20
21
22 var args = Array.prototype.slice.call(Seed.argv);
23
24 args.shift();
25 args.shift();
26 //print(JSON.stringify(args, null,4));
27 //Seed.quit();
28
29
30
31 var tr = new  TokenReader(  { 
32     keepDocs :true, 
33     keepWhite : true,  
34     keepComments : true, 
35     sepIdents : false,
36     collapseWhite : true,
37     filename : args[0],
38     ignoreBadGrammer: true
39 });
40
41 var str = File.read(args[0])
42
43 var toks = tr.tokenize(new TextStream(str));  
44
45
46 var rf = new RooFile(toks);
47 //print(JSON.stringify(rf.tokens, null,4));Seed.quit();
48
49
50
51
52 rf.parse();
53
54 print("------------ in ------------------");
55 print(str);
56 print("------------ out ------------------");
57
58 print(JSON.stringify(rf.cfg, null,4));
59
60 print("------------ was ------------------");
61
62 print(File.read(args[0].replace(/\.js$/,'.bjs')));
63