| OLD | NEW |
| (Empty) |
| 1 // This is a complex script used for producing doxygen-readable input | |
| 2 | |
| 3 /* The following is a sample doxygen input file: | |
| 4 FILE doxygen.js | |
| 5 // Documentation for thing | |
| 6 0:0 VARIABLE variable1 | |
| 7 // More documentation | |
| 8 1:0 FUNCTION function ARGS a b c | |
| 9 // Yet more documentation | |
| 10 25:0 CLASS clazz INHERITS base1 base2 | |
| 11 40:2 CLASS VARIABLE clazzvar | |
| 12 41:2 CLASS METHOD clazzfunc ARGS | |
| 13 52:2 CLASS GETTER vara ARGS | |
| 14 // Some Constant | |
| 15 101:0 CONSTANT const1 VALUE 10 | |
| 16 */ | |
| 17 | |
| 18 include("../utils/dumpast.js"); | |
| 19 include("../utils/cleanast.js"); | |
| 20 include("../utils/comments.js"); | |
| 21 include("../utils/jstypes.js"); | |
| 22 | |
| 23 function process_js(ast, f) { | |
| 24 _print("FILE " + f); | |
| 25 function loc(l) { | |
| 26 return l.line + ":" + l.column; | |
| 27 } | |
| 28 let toplevel = clean_ast(ast); | |
| 29 associate_comments(f, toplevel); | |
| 30 for each (let v in toplevel.variables) { | |
| 31 if (v.comment) | |
| 32 _print(v.comment); | |
| 33 _print(loc(v.loc) + " VARIABLE " + v.name); | |
| 34 } | |
| 35 for each (let v in toplevel.constants) { | |
| 36 if (v.comment) | |
| 37 _print(v.comment); | |
| 38 _print(loc(v.loc) + " CONST " + v.name); | |
| 39 } | |
| 40 for each (let v in toplevel.objects) { | |
| 41 divine_inheritance(v, toplevel.constants); | |
| 42 if (v.comment) | |
| 43 _print(v.comment); | |
| 44 let inherits = v.inherits ? (" INHERITS " + v.inherits.join(", ")) : ""; | |
| 45 _print(loc(v.loc) + " CLASS " + v.name + inherits); | |
| 46 let attrs = { METHOD: v.functions, VARIABLE: v.variables, GETTER: v.getters, | |
| 47 SETTER: v.setters }; | |
| 48 for (let attr in attrs) { | |
| 49 for (let name in attrs[attr]) { | |
| 50 if (attrs[attr][name].comment) | |
| 51 _print(attrs[attr][name].comment); | |
| 52 _print(loc(attrs[attr][name].loc) + " CLASS " + attr + " " + name); | |
| 53 } | |
| 54 } | |
| 55 _print("CLASS END"); | |
| 56 } | |
| 57 for each (let v in toplevel.classes) { | |
| 58 divine_inheritance(v, toplevel.constants); | |
| 59 if (v.constructor && v.constructor.comment) | |
| 60 _print(v.constructor.comment); | |
| 61 if (v.comment) | |
| 62 _print(v.comment); | |
| 63 let inherits = v.inherits ? (" INHERITS " + v.inherits.join(", ")) : ""; | |
| 64 _print(loc(v.loc) + " CLASS " + v.name + inherits); | |
| 65 let attrs = { METHOD: v.functions, VARIABLE: v.variables, GETTER: v.getters, | |
| 66 SETTER: v.setters }; | |
| 67 for (let attr in attrs) { | |
| 68 for (let name in attrs[attr]) { | |
| 69 if (attrs[attr][name].comment) | |
| 70 _print(attrs[attr][name].comment); | |
| 71 _print(loc(attrs[attr][name].loc) + " CLASS " + attr + " " + name); | |
| 72 } | |
| 73 } | |
| 74 _print("CLASS END"); | |
| 75 } | |
| 76 for each (let v in toplevel.functions) { | |
| 77 if (v.comment) | |
| 78 _print(v.comment); | |
| 79 _print(loc(v.loc) + " FUNCTION " + v.name); | |
| 80 } | |
| 81 } | |
| OLD | NEW |