Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: scripts/doxygen.js

Issue 29350140: Issue 4353 - Remove non standard for each syntax (Closed)
Left Patch Set: Created Aug. 24, 2016, 11:08 a.m.
Right Patch Set: Removed unused code Created Aug. 24, 2016, 2:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « scripts/decompile.js ('k') | scripts/dxr.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 (let v of toplevel.variables) {
31 if (v.comment)
32 _print(v.comment);
33 _print(loc(v.loc) + " VARIABLE " + v.name);
34 }
35 for (let v of toplevel.constants) {
36 if (v.comment)
37 _print(v.comment);
38 _print(loc(v.loc) + " CONST " + v.name);
39 }
40 for (let v of 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 (let v of 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 (let v of toplevel.functions) {
77 if (v.comment)
78 _print(v.comment);
79 _print(loc(v.loc) + " FUNCTION " + v.name);
80 }
81 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld