jsc3d-rails 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +21 -0
  4. data/README.md +33 -0
  5. data/jsc3d-rails.gemspec +23 -0
  6. data/lib/generators/jquery/install/install_generator.rb +59 -0
  7. data/lib/jsc3d-rails.rb +1 -0
  8. data/lib/jsc3d/rails.rb +8 -0
  9. data/lib/jsc3d/rails/engine.rb +6 -0
  10. data/lib/jsc3d/rails/version.rb +6 -0
  11. data/vendor/assets/javascripts/bin/jsc3d.min.js +139 -0
  12. data/vendor/assets/javascripts/bin/jsc3d_ie.min.js +133 -0
  13. data/vendor/assets/javascripts/build/compile.bat +1 -0
  14. data/vendor/assets/javascripts/build/compile.sh +2 -0
  15. data/vendor/assets/javascripts/build/gendoc.bat +2 -0
  16. data/vendor/assets/javascripts/build/gendoc.sh +2 -0
  17. data/vendor/assets/javascripts/docs/files.html +247 -0
  18. data/vendor/assets/javascripts/docs/index.html +349 -0
  19. data/vendor/assets/javascripts/docs/symbols/JSC3D.AABB.html +436 -0
  20. data/vendor/assets/javascripts/docs/symbols/JSC3D.BinaryStream.html +1051 -0
  21. data/vendor/assets/javascripts/docs/symbols/JSC3D.LoaderSelector.html +455 -0
  22. data/vendor/assets/javascripts/docs/symbols/JSC3D.Material.html +430 -0
  23. data/vendor/assets/javascripts/docs/symbols/JSC3D.Math3D.html +468 -0
  24. data/vendor/assets/javascripts/docs/symbols/JSC3D.Matrix3x4.html +682 -0
  25. data/vendor/assets/javascripts/docs/symbols/JSC3D.Mesh.html +628 -0
  26. data/vendor/assets/javascripts/docs/symbols/JSC3D.ObjLoader.html +428 -0
  27. data/vendor/assets/javascripts/docs/symbols/JSC3D.PickInfo.html +332 -0
  28. data/vendor/assets/javascripts/docs/symbols/JSC3D.Scene.html +571 -0
  29. data/vendor/assets/javascripts/docs/symbols/JSC3D.StlLoader.html +473 -0
  30. data/vendor/assets/javascripts/docs/symbols/JSC3D.Texture.html +589 -0
  31. data/vendor/assets/javascripts/docs/symbols/JSC3D.Viewer.html +1156 -0
  32. data/vendor/assets/javascripts/docs/symbols/JSC3D.html +329 -0
  33. data/vendor/assets/javascripts/docs/symbols/_global_.html +279 -0
  34. data/vendor/assets/javascripts/docs/symbols/src/jsc3d.js.html +4804 -0
  35. data/vendor/assets/javascripts/jsc3d.console.js +146 -0
  36. data/vendor/assets/javascripts/jsc3d.js +4796 -0
  37. data/vendor/assets/javascripts/jsc3d_ie.js +4487 -0
  38. data/vendor/assets/javascripts/tools/closure/COPYING +202 -0
  39. data/vendor/assets/javascripts/tools/closure/README +261 -0
  40. data/vendor/assets/javascripts/tools/closure/USAGE +87 -0
  41. data/vendor/assets/javascripts/tools/closure/compiler.jar +0 -0
  42. data/vendor/assets/javascripts/tools/doc_generator/README.txt +146 -0
  43. data/vendor/assets/javascripts/tools/doc_generator/app/frame.js +33 -0
  44. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Chain.js +102 -0
  45. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Dumper.js +144 -0
  46. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Hash.js +84 -0
  47. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Link.js +148 -0
  48. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Namespace.js +10 -0
  49. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Opt.js +134 -0
  50. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Reflection.js +26 -0
  51. data/vendor/assets/javascripts/tools/doc_generator/app/frame/String.js +93 -0
  52. data/vendor/assets/javascripts/tools/doc_generator/app/frame/Testrun.js +129 -0
  53. data/vendor/assets/javascripts/tools/doc_generator/app/handlers/FOODOC.js +26 -0
  54. data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC.js +26 -0
  55. data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC/DomReader.js +159 -0
  56. data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC/XMLDoc.js +16 -0
  57. data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC/XMLParse.js +292 -0
  58. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC.js +101 -0
  59. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/DocComment.js +200 -0
  60. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/DocTag.js +294 -0
  61. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/JsDoc.js +126 -0
  62. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/JsPlate.js +109 -0
  63. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Lang.js +144 -0
  64. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Parser.js +107 -0
  65. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/PluginManager.js +33 -0
  66. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Symbol.js +643 -0
  67. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/SymbolSet.js +229 -0
  68. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/TextStream.js +41 -0
  69. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Token.js +18 -0
  70. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/TokenReader.js +332 -0
  71. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/TokenStream.js +133 -0
  72. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Util.js +32 -0
  73. data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Walker.js +459 -0
  74. data/vendor/assets/javascripts/tools/doc_generator/app/main.js +111 -0
  75. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/commentSrcJson.js +20 -0
  76. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/frameworkPrototype.js +16 -0
  77. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/functionCall.js +10 -0
  78. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/publishSrcHilite.js +62 -0
  79. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/symbolLink.js +9 -0
  80. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/tagParamConfig.js +31 -0
  81. data/vendor/assets/javascripts/tools/doc_generator/app/plugins/tagSynonyms.js +43 -0
  82. data/vendor/assets/javascripts/tools/doc_generator/app/run.js +348 -0
  83. data/vendor/assets/javascripts/tools/doc_generator/app/t/TestDoc.js +144 -0
  84. data/vendor/assets/javascripts/tools/doc_generator/app/t/runner.js +13 -0
  85. data/vendor/assets/javascripts/tools/doc_generator/app/test.js +307 -0
  86. data/vendor/assets/javascripts/tools/doc_generator/app/test/addon.js +24 -0
  87. data/vendor/assets/javascripts/tools/doc_generator/app/test/anon_inner.js +14 -0
  88. data/vendor/assets/javascripts/tools/doc_generator/app/test/augments.js +31 -0
  89. data/vendor/assets/javascripts/tools/doc_generator/app/test/augments2.js +26 -0
  90. data/vendor/assets/javascripts/tools/doc_generator/app/test/borrows.js +41 -0
  91. data/vendor/assets/javascripts/tools/doc_generator/app/test/borrows2.js +23 -0
  92. data/vendor/assets/javascripts/tools/doc_generator/app/test/config.js +22 -0
  93. data/vendor/assets/javascripts/tools/doc_generator/app/test/constructs.js +18 -0
  94. data/vendor/assets/javascripts/tools/doc_generator/app/test/encoding.js +10 -0
  95. data/vendor/assets/javascripts/tools/doc_generator/app/test/encoding_other.js +12 -0
  96. data/vendor/assets/javascripts/tools/doc_generator/app/test/event.js +54 -0
  97. data/vendor/assets/javascripts/tools/doc_generator/app/test/functions_anon.js +39 -0
  98. data/vendor/assets/javascripts/tools/doc_generator/app/test/functions_nested.js +33 -0
  99. data/vendor/assets/javascripts/tools/doc_generator/app/test/global.js +13 -0
  100. data/vendor/assets/javascripts/tools/doc_generator/app/test/globals.js +25 -0
  101. data/vendor/assets/javascripts/tools/doc_generator/app/test/ignore.js +10 -0
  102. data/vendor/assets/javascripts/tools/doc_generator/app/test/inner.js +16 -0
  103. data/vendor/assets/javascripts/tools/doc_generator/app/test/jsdoc_test.js +477 -0
  104. data/vendor/assets/javascripts/tools/doc_generator/app/test/lend.js +33 -0
  105. data/vendor/assets/javascripts/tools/doc_generator/app/test/memberof.js +19 -0
  106. data/vendor/assets/javascripts/tools/doc_generator/app/test/memberof_constructor.js +17 -0
  107. data/vendor/assets/javascripts/tools/doc_generator/app/test/name.js +19 -0
  108. data/vendor/assets/javascripts/tools/doc_generator/app/test/namespace_nested.js +23 -0
  109. data/vendor/assets/javascripts/tools/doc_generator/app/test/nocode.js +13 -0
  110. data/vendor/assets/javascripts/tools/doc_generator/app/test/oblit_anon.js +20 -0
  111. data/vendor/assets/javascripts/tools/doc_generator/app/test/overview.js +20 -0
  112. data/vendor/assets/javascripts/tools/doc_generator/app/test/param_inline.js +37 -0
  113. data/vendor/assets/javascripts/tools/doc_generator/app/test/params_optional.js +8 -0
  114. data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype.js +17 -0
  115. data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype_nested.js +9 -0
  116. data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype_oblit.js +13 -0
  117. data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype_oblit_constructor.js +24 -0
  118. data/vendor/assets/javascripts/tools/doc_generator/app/test/public.js +10 -0
  119. data/vendor/assets/javascripts/tools/doc_generator/app/test/shared.js +42 -0
  120. data/vendor/assets/javascripts/tools/doc_generator/app/test/shared2.js +2 -0
  121. data/vendor/assets/javascripts/tools/doc_generator/app/test/shortcuts.js +22 -0
  122. data/vendor/assets/javascripts/tools/doc_generator/app/test/static_this.js +13 -0
  123. data/vendor/assets/javascripts/tools/doc_generator/app/test/synonyms.js +31 -0
  124. data/vendor/assets/javascripts/tools/doc_generator/app/test/tosource.js +23 -0
  125. data/vendor/assets/javascripts/tools/doc_generator/app/test/variable_redefine.js +14 -0
  126. data/vendor/assets/javascripts/tools/doc_generator/changes.txt +75 -0
  127. data/vendor/assets/javascripts/tools/doc_generator/conf/sample.conf +31 -0
  128. data/vendor/assets/javascripts/tools/doc_generator/java/build.xml +36 -0
  129. data/vendor/assets/javascripts/tools/doc_generator/java/build_1.4.xml +36 -0
  130. data/vendor/assets/javascripts/tools/doc_generator/java/classes/js.jar +0 -0
  131. data/vendor/assets/javascripts/tools/doc_generator/java/src/JsDebugRun.java +21 -0
  132. data/vendor/assets/javascripts/tools/doc_generator/java/src/JsRun.java +21 -0
  133. data/vendor/assets/javascripts/tools/doc_generator/jsdebug.jar +0 -0
  134. data/vendor/assets/javascripts/tools/doc_generator/jsrun.jar +0 -0
  135. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/allclasses.tmpl +17 -0
  136. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/allfiles.tmpl +56 -0
  137. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/class.tmpl +646 -0
  138. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/index.tmpl +39 -0
  139. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/publish.js +184 -0
  140. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/static/default.css +165 -0
  141. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/static/header.html +2 -0
  142. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/static/index.html +19 -0
  143. data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/symbol.tmpl +35 -0
  144. metadata +234 -0
@@ -0,0 +1,133 @@
1
+ if (typeof JSDOC == "undefined") JSDOC = {};
2
+
3
+ /**
4
+ @constructor
5
+ */
6
+ JSDOC.TokenStream = function(tokens) {
7
+ this.tokens = (tokens || []);
8
+ this.rewind();
9
+ }
10
+
11
+ /**
12
+ @constructor
13
+ @private
14
+ */
15
+ function VoidToken(/**String*/type) {
16
+ this.toString = function() {return "<VOID type=\""+type+"\">"};
17
+ this.is = function(){return false;}
18
+ }
19
+
20
+ JSDOC.TokenStream.prototype.rewind = function() {
21
+ this.cursor = -1;
22
+ }
23
+
24
+ /**
25
+ @type JSDOC.Token
26
+ */
27
+ JSDOC.TokenStream.prototype.look = function(/**Number*/n, /**Boolean*/considerWhitespace) {
28
+ if (typeof n == "undefined") n = 0;
29
+
30
+ if (considerWhitespace == true) {
31
+ if (this.cursor+n < 0 || this.cursor+n > this.tokens.length) return {};
32
+ return this.tokens[this.cursor+n];
33
+ }
34
+ else {
35
+ var count = 0;
36
+ var i = this.cursor;
37
+
38
+ while (true) {
39
+ if (i < 0) return new JSDOC.Token("", "VOID", "START_OF_STREAM");
40
+ else if (i > this.tokens.length) return new JSDOC.Token("", "VOID", "END_OF_STREAM");
41
+
42
+ if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT"))) {
43
+ if (n < 0) i--; else i++;
44
+ continue;
45
+ }
46
+
47
+ if (count == Math.abs(n)) {
48
+ return this.tokens[i];
49
+ }
50
+ count++;
51
+ (n < 0)? i-- : i++;
52
+ }
53
+
54
+ return new JSDOC.Token("", "VOID", "STREAM_ERROR"); // because null isn't an object and caller always expects an object
55
+ }
56
+ }
57
+
58
+ /**
59
+ @type JSDOC.Token|JSDOC.Token[]
60
+ */
61
+ JSDOC.TokenStream.prototype.next = function(/**Number*/howMany) {
62
+ if (typeof howMany == "undefined") howMany = 1;
63
+ if (howMany < 1) return null;
64
+ var got = [];
65
+
66
+ for (var i = 1; i <= howMany; i++) {
67
+ if (this.cursor+i >= this.tokens.length) {
68
+ return null;
69
+ }
70
+ got.push(this.tokens[this.cursor+i]);
71
+ }
72
+ this.cursor += howMany;
73
+
74
+ if (howMany == 1) {
75
+ return got[0];
76
+ }
77
+ else return got;
78
+ }
79
+
80
+ /**
81
+ @type JSDOC.Token[]
82
+ */
83
+ JSDOC.TokenStream.prototype.balance = function(/**String*/start, /**String*/stop) {
84
+ if (!stop) stop = JSDOC.Lang.matching(start);
85
+
86
+ var depth = 0;
87
+ var got = [];
88
+ var started = false;
89
+
90
+ while ((token = this.look())) {
91
+ if (token.is(start)) {
92
+ depth++;
93
+ started = true;
94
+ }
95
+
96
+ if (started) {
97
+ got.push(token);
98
+ }
99
+
100
+ if (token.is(stop)) {
101
+ depth--;
102
+ if (depth == 0) return got;
103
+ }
104
+ if (!this.next()) break;
105
+ }
106
+ }
107
+
108
+ JSDOC.TokenStream.prototype.getMatchingToken = function(/**String*/start, /**String*/stop) {
109
+ var depth = 0;
110
+ var cursor = this.cursor;
111
+
112
+ if (!start) {
113
+ start = JSDOC.Lang.matching(stop);
114
+ depth = 1;
115
+ }
116
+ if (!stop) stop = JSDOC.Lang.matching(start);
117
+
118
+ while ((token = this.tokens[cursor])) {
119
+ if (token.is(start)) {
120
+ depth++;
121
+ }
122
+
123
+ if (token.is(stop) && cursor) {
124
+ depth--;
125
+ if (depth == 0) return this.tokens[cursor];
126
+ }
127
+ cursor++;
128
+ }
129
+ }
130
+
131
+ JSDOC.TokenStream.prototype.insertAhead = function(/**JSDOC.Token*/token) {
132
+ this.tokens.splice(this.cursor+1, 0, token);
133
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @namespace
3
+ * @deprecated Use {@link FilePath} instead.
4
+ */
5
+ JSDOC.Util = {
6
+ }
7
+
8
+ /**
9
+ * @deprecated Use {@link FilePath.fileName} instead.
10
+ */
11
+ JSDOC.Util.fileName = function(path) {
12
+ LOG.warn("JSDOC.Util.fileName is deprecated. Use FilePath.fileName instead.");
13
+ var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
14
+ return path.substring(nameStart);
15
+ }
16
+
17
+ /**
18
+ * @deprecated Use {@link FilePath.fileExtension} instead.
19
+ */
20
+ JSDOC.Util.fileExtension = function(filename) {
21
+ LOG.warn("JSDOC.Util.fileExtension is deprecated. Use FilePath.fileExtension instead.");
22
+ return filename.split(".").pop().toLowerCase();
23
+ };
24
+
25
+ /**
26
+ * @deprecated Use {@link FilePath.dir} instead.
27
+ */
28
+ JSDOC.Util.dir = function(path) {
29
+ LOG.warn("JSDOC.Util.dir is deprecated. Use FilePath.dir instead.");
30
+ var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
31
+ return path.substring(0, nameStart-1);
32
+ }
@@ -0,0 +1,459 @@
1
+ if (typeof JSDOC == "undefined") JSDOC = {};
2
+
3
+ /** @constructor */
4
+ JSDOC.Walker = function(/**JSDOC.TokenStream*/ts) {
5
+ this.init();
6
+ if (typeof ts != "undefined") {
7
+ this.walk(ts);
8
+ }
9
+ }
10
+
11
+ JSDOC.Walker.prototype.init = function() {
12
+ this.ts = null;
13
+
14
+ var globalSymbol = new JSDOC.Symbol("_global_", [], "GLOBAL", new JSDOC.DocComment(""));
15
+ globalSymbol.isNamespace = true;
16
+ globalSymbol.srcFile = "";
17
+ globalSymbol.isPrivate = false;
18
+ JSDOC.Parser.addSymbol(globalSymbol);
19
+ this.lastDoc = null;
20
+ this.token = null;
21
+
22
+ /**
23
+ The chain of symbols under which we are currently nested.
24
+ @type Array
25
+ */
26
+ this.namescope = [globalSymbol];
27
+ this.namescope.last = function(n){ if (!n) n = 0; return this[this.length-(1+n)] || "" };
28
+ }
29
+
30
+ JSDOC.Walker.prototype.walk = function(/**JSDOC.TokenStream*/ts) {
31
+ this.ts = ts;
32
+ while (this.token = this.ts.look()) {
33
+ if (this.token.popNamescope) {
34
+
35
+ var symbol = this.namescope.pop();
36
+ if (symbol.is("FUNCTION")) {
37
+ if (this.ts.look(1).is("LEFT_PAREN") && symbol.comment.getTag("function").length == 0) {
38
+ symbol.isa = "OBJECT";
39
+ }
40
+ }
41
+ }
42
+ this.step();
43
+ if (!this.ts.next()) break;
44
+ }
45
+ }
46
+
47
+ JSDOC.Walker.prototype.step = function() {
48
+ if (this.token.is("JSDOC")) { // it's a doc comment
49
+
50
+ var doc = new JSDOC.DocComment(this.token.data);
51
+
52
+ if (doc.getTag("lends").length > 0) {
53
+ var lends = doc.getTag("lends")[0];
54
+
55
+ var name = lends.desc
56
+ if (!name) throw "@lends tag requires a value.";
57
+
58
+ var symbol = new JSDOC.Symbol(name, [], "OBJECT", doc);
59
+
60
+ this.namescope.push(symbol);
61
+
62
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
63
+ if (matching) matching.popNamescope = name;
64
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
65
+
66
+ this.lastDoc = null;
67
+ return true;
68
+ }
69
+ else if (doc.getTag("name").length > 0 && doc.getTag("overview").length == 0) { // it's a virtual symbol
70
+ var virtualName = doc.getTag("name")[0].desc;
71
+ if (!virtualName) throw "@name tag requires a value.";
72
+
73
+ var symbol = new JSDOC.Symbol(virtualName, [], "VIRTUAL", doc);
74
+
75
+ JSDOC.Parser.addSymbol(symbol);
76
+
77
+ this.lastDoc = null;
78
+ return true;
79
+ }
80
+ else if (doc.meta) { // it's a meta doclet
81
+ if (doc.meta == "@+") JSDOC.DocComment.shared = doc.src;
82
+ else if (doc.meta == "@-") JSDOC.DocComment.shared = "";
83
+ else if (doc.meta == "nocode+") JSDOC.Parser.conf.ignoreCode = true;
84
+ else if (doc.meta == "nocode-") JSDOC.Parser.conf.ignoreCode = JSDOC.opt.n;
85
+ else throw "Unrecognized meta comment: "+doc.meta;
86
+
87
+ this.lastDoc = null;
88
+ return true;
89
+ }
90
+ else if (doc.getTag("overview").length > 0) { // it's a file overview
91
+ symbol = new JSDOC.Symbol("", [], "FILE", doc);
92
+
93
+ JSDOC.Parser.addSymbol(symbol);
94
+
95
+ this.lastDoc = null;
96
+ return true;
97
+ }
98
+ else {
99
+ this.lastDoc = doc;
100
+ return false;
101
+ }
102
+ }
103
+ else if (!JSDOC.Parser.conf.ignoreCode) { // it's code
104
+ if (this.token.is("NAME")) {
105
+ var symbol;
106
+ var name = this.token.data;
107
+ var doc = null; if (this.lastDoc) doc = this.lastDoc;
108
+ var params = [];
109
+
110
+ // it's inside an anonymous object
111
+ if (this.ts.look(1).is("COLON") && this.ts.look(-1).is("LEFT_CURLY") && !(this.ts.look(-2).is("JSDOC") || this.namescope.last().comment.getTag("lends").length || this.ts.look(-2).is("ASSIGN") || this.ts.look(-2).is("COLON"))) {
112
+ name = "$anonymous";
113
+ name = this.namescope.last().alias+"-"+name
114
+
115
+ params = [];
116
+
117
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
118
+
119
+ JSDOC.Parser.addSymbol(symbol);
120
+
121
+ this.namescope.push(symbol);
122
+
123
+ var matching = this.ts.getMatchingToken(null, "RIGHT_CURLY");
124
+ if (matching) matching.popNamescope = name;
125
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
126
+ }
127
+ // function foo() {}
128
+ else if (this.ts.look(-1).is("FUNCTION") && this.ts.look(1).is("LEFT_PAREN")) {
129
+ var isInner;
130
+
131
+ if (this.lastDoc) doc = this.lastDoc;
132
+ name = this.namescope.last().alias+"-"+name;
133
+ if (!this.namescope.last().is("GLOBAL")) isInner = true;
134
+
135
+ params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
136
+
137
+ symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
138
+ if (isInner) symbol.isInner = true;
139
+
140
+ if (this.ts.look(1).is("JSDOC")) {
141
+ var inlineReturn = ""+this.ts.look(1).data;
142
+ inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
143
+ symbol.type = inlineReturn;
144
+ }
145
+
146
+ JSDOC.Parser.addSymbol(symbol);
147
+
148
+ this.namescope.push(symbol);
149
+
150
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
151
+ if (matching) matching.popNamescope = name;
152
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
153
+ }
154
+ // foo = function() {}
155
+ else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("FUNCTION")) {
156
+ var isInner;
157
+ if (this.ts.look(-1).is("VAR") || this.isInner) {
158
+ name = this.namescope.last().alias+"-"+name
159
+ if (!this.namescope.last().is("GLOBAL")) isInner = true;
160
+ }
161
+ else if (name.indexOf("this.") == 0) {
162
+ name = this.resolveThis(name);
163
+ }
164
+
165
+ if (this.lastDoc) doc = this.lastDoc;
166
+ params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
167
+
168
+ symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
169
+ if (isInner) symbol.isInner = true;
170
+
171
+ if (this.ts.look(1).is("JSDOC")) {
172
+ var inlineReturn = ""+this.ts.look(1).data;
173
+ inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
174
+ symbol.type = inlineReturn;
175
+ }
176
+
177
+ JSDOC.Parser.addSymbol(symbol);
178
+
179
+ this.namescope.push(symbol);
180
+
181
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
182
+ if (matching) matching.popNamescope = name;
183
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
184
+ }
185
+ // foo = new function() {}
186
+ else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("NEW") && this.ts.look(3).is("FUNCTION")) {
187
+ var isInner;
188
+ if (this.ts.look(-1).is("VAR") || this.isInner) {
189
+ name = this.namescope.last().alias+"-"+name
190
+ if (!this.namescope.last().is("GLOBAL")) isInner = true;
191
+ }
192
+ else if (name.indexOf("this.") == 0) {
193
+ name = this.resolveThis(name);
194
+ }
195
+
196
+ if (this.lastDoc) doc = this.lastDoc;
197
+ params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
198
+
199
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
200
+ if (isInner) symbol.isInner = true;
201
+
202
+ if (this.ts.look(1).is("JSDOC")) {
203
+ var inlineReturn = ""+this.ts.look(1).data;
204
+ inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
205
+ symbol.type = inlineReturn;
206
+ }
207
+
208
+ JSDOC.Parser.addSymbol(symbol);
209
+
210
+ symbol.scopeType = "INSTANCE";
211
+ this.namescope.push(symbol);
212
+
213
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
214
+ if (matching) matching.popNamescope = name;
215
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
216
+ }
217
+ // foo: function() {}
218
+ else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("FUNCTION")) {
219
+ name = (this.namescope.last().alias+"."+name).replace("#.", "#");
220
+
221
+ if (this.lastDoc) doc = this.lastDoc;
222
+ params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
223
+
224
+ if (doc && doc.getTag("constructs").length) {
225
+ name = name.replace(/\.prototype(\.|$)/, "#");
226
+
227
+ if (name.indexOf("#") > -1) name = name.match(/(^[^#]+)/)[0];
228
+ else name = this.namescope.last().alias;
229
+
230
+ symbol = new JSDOC.Symbol(name, params, "CONSTRUCTOR", doc);
231
+ }
232
+ else {
233
+ symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
234
+ }
235
+
236
+ if (this.ts.look(1).is("JSDOC")) {
237
+ var inlineReturn = ""+this.ts.look(1).data;
238
+ inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
239
+ symbol.type = inlineReturn;
240
+ }
241
+
242
+ JSDOC.Parser.addSymbol(symbol);
243
+
244
+ this.namescope.push(symbol);
245
+
246
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
247
+ if (matching) matching.popNamescope = name;
248
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
249
+ }
250
+ // foo = {}
251
+ else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("LEFT_CURLY")) {
252
+ var isInner;
253
+ if (this.ts.look(-1).is("VAR") || this.isInner) {
254
+ name = this.namescope.last().alias+"-"+name
255
+ if (!this.namescope.last().is("GLOBAL")) isInner = true;
256
+ }
257
+ else if (name.indexOf("this.") == 0) {
258
+ name = this.resolveThis(name);
259
+ }
260
+
261
+ if (this.lastDoc) doc = this.lastDoc;
262
+
263
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
264
+ if (isInner) symbol.isInner = true;
265
+
266
+
267
+ if (doc) JSDOC.Parser.addSymbol(symbol);
268
+
269
+ this.namescope.push(symbol);
270
+
271
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
272
+ if (matching) matching.popNamescope = name;
273
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
274
+ }
275
+ // var foo;
276
+ else if (this.ts.look(1).is("SEMICOLON")) {
277
+ var isInner;
278
+ if (this.ts.look(-1).is("VAR") || this.isInner) {
279
+ name = this.namescope.last().alias+"-"+name
280
+ if (!this.namescope.last().is("GLOBAL")) isInner = true;
281
+
282
+ if (this.lastDoc) doc = this.lastDoc;
283
+
284
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
285
+ if (isInner) symbol.isInner = true;
286
+
287
+
288
+ if (doc) JSDOC.Parser.addSymbol(symbol);
289
+ }
290
+ }
291
+ // foo = x
292
+ else if (this.ts.look(1).is("ASSIGN")) {
293
+
294
+ var isInner;
295
+ if (this.ts.look(-1).is("VAR") || this.isInner) {
296
+ name = this.namescope.last().alias+"-"+name
297
+ if (!this.namescope.last().is("GLOBAL")) isInner = true;
298
+ }
299
+ else if (name.indexOf("this.") == 0) {
300
+ name = this.resolveThis(name);
301
+ }
302
+
303
+ if (this.lastDoc) doc = this.lastDoc;
304
+
305
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
306
+ if (isInner) symbol.isInner = true;
307
+
308
+
309
+ if (doc) JSDOC.Parser.addSymbol(symbol);
310
+ }
311
+ // foo: {}
312
+ else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("LEFT_CURLY")) {
313
+ name = (this.namescope.last().alias+"."+name).replace("#.", "#");
314
+
315
+ if (this.lastDoc) doc = this.lastDoc;
316
+
317
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
318
+
319
+
320
+ if (doc) JSDOC.Parser.addSymbol(symbol);
321
+
322
+ this.namescope.push(symbol);
323
+
324
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
325
+ if (matching) matching.popNamescope = name;
326
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
327
+ }
328
+ // foo: x
329
+ else if (this.ts.look(1).is("COLON")) {
330
+ name = (this.namescope.last().alias+"."+name).replace("#.", "#");;
331
+
332
+ if (this.lastDoc) doc = this.lastDoc;
333
+
334
+ symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
335
+
336
+
337
+ if (doc) JSDOC.Parser.addSymbol(symbol);
338
+ }
339
+ // foo(...)
340
+ else if (this.ts.look(1).is("LEFT_PAREN")) {
341
+ if (typeof JSDOC.PluginManager != "undefined") {
342
+ var functionCall = {name: name};
343
+
344
+ var cursor = this.ts.cursor;
345
+ params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
346
+ this.ts.cursor = cursor;
347
+
348
+ for (var i = 0; i < params.length; i++)
349
+ functionCall["arg" + (i + 1)] = params[i].name;
350
+
351
+ JSDOC.PluginManager.run("onFunctionCall", functionCall);
352
+ if (functionCall.doc) {
353
+ this.ts.insertAhead(new JSDOC.Token(functionCall.doc, "COMM", "JSDOC"));
354
+ }
355
+ }
356
+ }
357
+ this.lastDoc = null;
358
+ }
359
+ else if (this.token.is("FUNCTION")) { // it's an anonymous function
360
+ if (
361
+ (!this.ts.look(-1).is("COLON") || !this.ts.look(-1).is("ASSIGN"))
362
+ && !this.ts.look(1).is("NAME")
363
+ ) {
364
+ if (this.lastDoc) doc = this.lastDoc;
365
+
366
+ name = "$anonymous";
367
+ name = this.namescope.last().alias+"-"+name
368
+
369
+ params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
370
+
371
+ symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
372
+
373
+
374
+ JSDOC.Parser.addSymbol(symbol);
375
+
376
+ this.namescope.push(symbol);
377
+
378
+ var matching = this.ts.getMatchingToken("LEFT_CURLY");
379
+ if (matching) matching.popNamescope = name;
380
+ else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
381
+ }
382
+ }
383
+ }
384
+ return true;
385
+ }
386
+
387
+ /**
388
+ Resolves what "this." means when it appears in a name.
389
+ @param name The name that starts with "this.".
390
+ @returns The name with "this." resolved.
391
+ */
392
+ JSDOC.Walker.prototype.resolveThis = function(name) {
393
+ name.match(/^this\.(.+)$/)
394
+ var nameFragment = RegExp.$1;
395
+ if (!nameFragment) return name;
396
+
397
+ var symbol = this.namescope.last();
398
+ var scopeType = symbol.scopeType || symbol.isa;
399
+
400
+ // if we are in a constructor function, `this` means the instance
401
+ if (scopeType == "CONSTRUCTOR") {
402
+ name = symbol.alias+"#"+nameFragment;
403
+ }
404
+
405
+ // if we are in an anonymous constructor function, `this` means the instance
406
+ else if (scopeType == "INSTANCE") {
407
+ name = symbol.alias+"."+nameFragment;
408
+ }
409
+
410
+ // if we are in a function, `this` means the container (possibly the global)
411
+ else if (scopeType == "FUNCTION") {
412
+ // in a method of a prototype, so `this` means the constructor
413
+ if (symbol.alias.match(/(^.*)[#.-][^#.-]+/)) {
414
+ var parentName = RegExp.$1;
415
+ var parent = JSDOC.Parser.symbols.getSymbol(parentName);
416
+
417
+ if (!parent) {
418
+ if (JSDOC.Lang.isBuiltin(parentName)) parent = JSDOC.Parser.addBuiltin(parentName);
419
+ else {
420
+ if (symbol.alias.indexOf("$anonymous") < 0) // these will be ignored eventually
421
+ LOG.warn("Trying to document "+symbol.alias+" without first documenting "+parentName+".");
422
+ }
423
+ }
424
+ if (parent) name = parentName+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment;
425
+ }
426
+ else {
427
+ parent = this.namescope.last(1);
428
+ name = parent.alias+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment;
429
+ }
430
+ }
431
+ // otherwise it means the global
432
+ else {
433
+ name = nameFragment;
434
+ }
435
+
436
+ return name;
437
+ }
438
+
439
+ JSDOC.Walker.onParamList = function(/**Array*/paramTokens) {
440
+ if (!paramTokens) {
441
+ LOG.warn("Malformed parameter list. Can't parse code.");
442
+ return [];
443
+ }
444
+ var params = [];
445
+ for (var i = 0, l = paramTokens.length; i < l; i++) {
446
+ if (paramTokens[i].is("JSDOC")) {
447
+ var paramType = paramTokens[i].data.replace(/(^\/\*\* *| *\*\/$)/g, "");
448
+
449
+ if (paramTokens[i+1] && paramTokens[i+1].is("NAME")) {
450
+ i++;
451
+ params.push({type: paramType, name: paramTokens[i].data});
452
+ }
453
+ }
454
+ else if (paramTokens[i].is("NAME")) {
455
+ params.push({name: paramTokens[i].data});
456
+ }
457
+ }
458
+ return params;
459
+ }