jsc3d-rails 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +33 -0
- data/jsc3d-rails.gemspec +23 -0
- data/lib/generators/jquery/install/install_generator.rb +59 -0
- data/lib/jsc3d-rails.rb +1 -0
- data/lib/jsc3d/rails.rb +8 -0
- data/lib/jsc3d/rails/engine.rb +6 -0
- data/lib/jsc3d/rails/version.rb +6 -0
- data/vendor/assets/javascripts/bin/jsc3d.min.js +139 -0
- data/vendor/assets/javascripts/bin/jsc3d_ie.min.js +133 -0
- data/vendor/assets/javascripts/build/compile.bat +1 -0
- data/vendor/assets/javascripts/build/compile.sh +2 -0
- data/vendor/assets/javascripts/build/gendoc.bat +2 -0
- data/vendor/assets/javascripts/build/gendoc.sh +2 -0
- data/vendor/assets/javascripts/docs/files.html +247 -0
- data/vendor/assets/javascripts/docs/index.html +349 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.AABB.html +436 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.BinaryStream.html +1051 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.LoaderSelector.html +455 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Material.html +430 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Math3D.html +468 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Matrix3x4.html +682 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Mesh.html +628 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.ObjLoader.html +428 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.PickInfo.html +332 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Scene.html +571 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.StlLoader.html +473 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Texture.html +589 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.Viewer.html +1156 -0
- data/vendor/assets/javascripts/docs/symbols/JSC3D.html +329 -0
- data/vendor/assets/javascripts/docs/symbols/_global_.html +279 -0
- data/vendor/assets/javascripts/docs/symbols/src/jsc3d.js.html +4804 -0
- data/vendor/assets/javascripts/jsc3d.console.js +146 -0
- data/vendor/assets/javascripts/jsc3d.js +4796 -0
- data/vendor/assets/javascripts/jsc3d_ie.js +4487 -0
- data/vendor/assets/javascripts/tools/closure/COPYING +202 -0
- data/vendor/assets/javascripts/tools/closure/README +261 -0
- data/vendor/assets/javascripts/tools/closure/USAGE +87 -0
- data/vendor/assets/javascripts/tools/closure/compiler.jar +0 -0
- data/vendor/assets/javascripts/tools/doc_generator/README.txt +146 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame.js +33 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Chain.js +102 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Dumper.js +144 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Hash.js +84 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Link.js +148 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Namespace.js +10 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Opt.js +134 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Reflection.js +26 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/String.js +93 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/frame/Testrun.js +129 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/handlers/FOODOC.js +26 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC.js +26 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC/DomReader.js +159 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC.js +101 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/DocComment.js +200 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/DocTag.js +294 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/JsDoc.js +126 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/JsPlate.js +109 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Lang.js +144 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Parser.js +107 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/PluginManager.js +33 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Symbol.js +643 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/SymbolSet.js +229 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/TextStream.js +41 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Token.js +18 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/TokenReader.js +332 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/TokenStream.js +133 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Util.js +32 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/lib/JSDOC/Walker.js +459 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/main.js +111 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/commentSrcJson.js +20 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/frameworkPrototype.js +16 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/functionCall.js +10 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/publishSrcHilite.js +62 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/symbolLink.js +9 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/tagParamConfig.js +31 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/plugins/tagSynonyms.js +43 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/run.js +348 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/t/TestDoc.js +144 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/t/runner.js +13 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test.js +307 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/addon.js +24 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/anon_inner.js +14 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/augments.js +31 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/augments2.js +26 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/borrows.js +41 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/borrows2.js +23 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/config.js +22 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/constructs.js +18 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/encoding.js +10 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/encoding_other.js +12 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/event.js +54 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/functions_anon.js +39 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/functions_nested.js +33 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/global.js +13 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/globals.js +25 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/ignore.js +10 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/inner.js +16 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/jsdoc_test.js +477 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/lend.js +33 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/memberof.js +19 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/memberof_constructor.js +17 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/name.js +19 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/namespace_nested.js +23 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/nocode.js +13 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/oblit_anon.js +20 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/overview.js +20 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/param_inline.js +37 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/params_optional.js +8 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype.js +17 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype_nested.js +9 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype_oblit.js +13 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/prototype_oblit_constructor.js +24 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/public.js +10 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/shared.js +42 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/shared2.js +2 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/shortcuts.js +22 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/static_this.js +13 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/synonyms.js +31 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/tosource.js +23 -0
- data/vendor/assets/javascripts/tools/doc_generator/app/test/variable_redefine.js +14 -0
- data/vendor/assets/javascripts/tools/doc_generator/changes.txt +75 -0
- data/vendor/assets/javascripts/tools/doc_generator/conf/sample.conf +31 -0
- data/vendor/assets/javascripts/tools/doc_generator/java/build.xml +36 -0
- data/vendor/assets/javascripts/tools/doc_generator/java/build_1.4.xml +36 -0
- data/vendor/assets/javascripts/tools/doc_generator/java/classes/js.jar +0 -0
- data/vendor/assets/javascripts/tools/doc_generator/java/src/JsDebugRun.java +21 -0
- data/vendor/assets/javascripts/tools/doc_generator/java/src/JsRun.java +21 -0
- data/vendor/assets/javascripts/tools/doc_generator/jsdebug.jar +0 -0
- data/vendor/assets/javascripts/tools/doc_generator/jsrun.jar +0 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/allclasses.tmpl +17 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/allfiles.tmpl +56 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/class.tmpl +646 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/index.tmpl +39 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/publish.js +184 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/static/default.css +165 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/static/header.html +2 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/static/index.html +19 -0
- data/vendor/assets/javascripts/tools/doc_generator/templates/jsdoc/symbol.tmpl +35 -0
- metadata +234 -0
@@ -0,0 +1,229 @@
|
|
1
|
+
/** @constructor */
|
2
|
+
JSDOC.SymbolSet = function() {
|
3
|
+
this.init();
|
4
|
+
}
|
5
|
+
|
6
|
+
JSDOC.SymbolSet.prototype.init = function() {
|
7
|
+
this._index = new Hash();
|
8
|
+
}
|
9
|
+
|
10
|
+
JSDOC.SymbolSet.prototype.keys = function() {
|
11
|
+
return this._index.keys();
|
12
|
+
}
|
13
|
+
|
14
|
+
JSDOC.SymbolSet.prototype.hasSymbol = function(alias) {
|
15
|
+
return this._index.hasKey(alias);
|
16
|
+
}
|
17
|
+
|
18
|
+
JSDOC.SymbolSet.prototype.addSymbol = function(symbol) {
|
19
|
+
if (this.hasSymbol(symbol.alias)) {
|
20
|
+
LOG.warn("Overwriting symbol documentation for: "+symbol.alias + ".");
|
21
|
+
}
|
22
|
+
this._index.set(symbol.alias, symbol);
|
23
|
+
}
|
24
|
+
|
25
|
+
JSDOC.SymbolSet.prototype.getSymbol = function(alias) {
|
26
|
+
if (this.hasSymbol(alias)) return this._index.get(alias);
|
27
|
+
}
|
28
|
+
|
29
|
+
JSDOC.SymbolSet.prototype.getSymbolByName = function(name) {
|
30
|
+
for (var p = this._index.first(); p; p = this._index.next()) {
|
31
|
+
var symbol = p.value;
|
32
|
+
if (symbol.name == name) return symbol;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
JSDOC.SymbolSet.prototype.toArray = function() {
|
37
|
+
return this._index.values();
|
38
|
+
}
|
39
|
+
|
40
|
+
JSDOC.SymbolSet.prototype.deleteSymbol = function(alias) {
|
41
|
+
if (!this.hasSymbol(alias)) return;
|
42
|
+
this._index.drop(alias);
|
43
|
+
}
|
44
|
+
|
45
|
+
JSDOC.SymbolSet.prototype.renameSymbol = function(oldName, newName) {
|
46
|
+
// todo: should check if oldname or newname already exist
|
47
|
+
this._index.replace(oldName, newName);
|
48
|
+
this._index.get(newName).alias = newName;
|
49
|
+
return newName;
|
50
|
+
}
|
51
|
+
|
52
|
+
JSDOC.SymbolSet.prototype.relate = function() {
|
53
|
+
this.resolveBorrows();
|
54
|
+
this.resolveMemberOf();
|
55
|
+
this.resolveAugments();
|
56
|
+
}
|
57
|
+
|
58
|
+
JSDOC.SymbolSet.prototype.resolveBorrows = function() {
|
59
|
+
for (var p = this._index.first(); p; p = this._index.next()) {
|
60
|
+
var symbol = p.value;
|
61
|
+
if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
|
62
|
+
|
63
|
+
var borrows = symbol.inherits;
|
64
|
+
for (var i = 0; i < borrows.length; i++) {
|
65
|
+
var borrowed = this.getSymbol(borrows[i].alias);
|
66
|
+
if (!borrowed) {
|
67
|
+
LOG.warn("Can't borrow undocumented "+borrows[i].alias+".");
|
68
|
+
continue;
|
69
|
+
}
|
70
|
+
|
71
|
+
var borrowAsName = borrows[i].as;
|
72
|
+
var borrowAsAlias = borrowAsName;
|
73
|
+
if (!borrowAsName) {
|
74
|
+
LOG.warn("Malformed @borrow, 'as' is required.");
|
75
|
+
continue;
|
76
|
+
}
|
77
|
+
|
78
|
+
if (borrowAsName.length > symbol.alias.length && borrowAsName.indexOf(symbol.alias) == 0) {
|
79
|
+
borrowAsName = borrowAsName.replace(borrowed.alias, "")
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
var joiner = "";
|
83
|
+
if (borrowAsName.charAt(0) != "#") joiner = ".";
|
84
|
+
borrowAsAlias = borrowed.alias + joiner + borrowAsName;
|
85
|
+
}
|
86
|
+
|
87
|
+
borrowAsName = borrowAsName.replace(/^[#.]/, "");
|
88
|
+
|
89
|
+
if (this.hasSymbol(borrowAsAlias)) continue;
|
90
|
+
|
91
|
+
var clone = borrowed.clone();
|
92
|
+
clone.name = borrowAsName;
|
93
|
+
clone.alias = borrowAsAlias;
|
94
|
+
this.addSymbol(clone);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
JSDOC.SymbolSet.prototype.resolveMemberOf = function() {
|
100
|
+
for (var p = this._index.first(); p; p = this._index.next()) {
|
101
|
+
var symbol = p.value;
|
102
|
+
if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
|
103
|
+
|
104
|
+
// the memberOf value was provided in the @memberOf tag
|
105
|
+
else if (symbol.memberOf) {
|
106
|
+
|
107
|
+
// like foo.bar is a memberOf foo
|
108
|
+
if (symbol.alias.indexOf(symbol.memberOf) == 0) {
|
109
|
+
var memberMatch = new RegExp("^("+symbol.memberOf+")[.#-]?(.+)$");
|
110
|
+
var aliasParts = symbol.alias.match(memberMatch);
|
111
|
+
|
112
|
+
if (aliasParts) {
|
113
|
+
symbol.memberOf = aliasParts[1];
|
114
|
+
symbol.name = aliasParts[2];
|
115
|
+
}
|
116
|
+
|
117
|
+
var nameParts = symbol.name.match(memberMatch);
|
118
|
+
|
119
|
+
if (nameParts) {
|
120
|
+
symbol.name = nameParts[2];
|
121
|
+
}
|
122
|
+
}
|
123
|
+
// like bar is a memberOf foo
|
124
|
+
else {
|
125
|
+
var joiner = symbol.memberOf.charAt(symbol.memberOf.length-1);
|
126
|
+
if (!/[.#-]/.test(joiner)) symbol.memberOf += ".";
|
127
|
+
this.renameSymbol(symbol.alias, symbol.memberOf + symbol.name);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
// the memberOf must be calculated
|
131
|
+
else {
|
132
|
+
var parts = symbol.alias.match(/^(.*[.#-])([^.#-]+)$/);
|
133
|
+
if (parts) {
|
134
|
+
symbol.memberOf = parts[1];
|
135
|
+
symbol.name = parts[2];
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
// set isStatic, isInner
|
140
|
+
if (symbol.memberOf) {
|
141
|
+
switch (symbol.memberOf.charAt(symbol.memberOf.length-1)) {
|
142
|
+
case '#' :
|
143
|
+
symbol.isStatic = false;
|
144
|
+
symbol.isInner = false;
|
145
|
+
break;
|
146
|
+
case '.' :
|
147
|
+
symbol.isStatic = true;
|
148
|
+
symbol.isInner = false;
|
149
|
+
break;
|
150
|
+
case '-' :
|
151
|
+
symbol.isStatic = false;
|
152
|
+
symbol.isInner = true;
|
153
|
+
break;
|
154
|
+
default: // memberOf ends in none of the above
|
155
|
+
symbol.isStatic = true;
|
156
|
+
break;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
// unowned methods and fields belong to the global object
|
161
|
+
if (!symbol.is("CONSTRUCTOR") && !symbol.isNamespace && symbol.memberOf == "") {
|
162
|
+
symbol.memberOf = "_global_";
|
163
|
+
}
|
164
|
+
|
165
|
+
// clean up
|
166
|
+
if (symbol.memberOf.match(/[.#-]$/)) {
|
167
|
+
symbol.memberOf = symbol.memberOf.substr(0, symbol.memberOf.length-1);
|
168
|
+
}
|
169
|
+
// add to parent's methods or properties list
|
170
|
+
if (symbol.memberOf) {
|
171
|
+
|
172
|
+
var container = this.getSymbol(symbol.memberOf);
|
173
|
+
if (!container) {
|
174
|
+
if (JSDOC.Lang.isBuiltin(symbol.memberOf)) container = JSDOC.Parser.addBuiltin(symbol.memberOf);
|
175
|
+
else {
|
176
|
+
LOG.warn("Trying to document "+symbol.name +" as a member of undocumented symbol "+symbol.memberOf+".");
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
if (container) container.addMember(symbol);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
JSDOC.SymbolSet.prototype.resolveAugments = function() {
|
186
|
+
for (var p = this._index.first(); p; p = this._index.next()) {
|
187
|
+
var symbol = p.value;
|
188
|
+
|
189
|
+
if (symbol.alias == "_global_" || symbol.is("FILE")) continue;
|
190
|
+
JSDOC.SymbolSet.prototype.walk.apply(this, [symbol]);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
JSDOC.SymbolSet.prototype.walk = function(symbol) {
|
195
|
+
var augments = symbol.augments;
|
196
|
+
for(var i = 0; i < augments.length; i++) {
|
197
|
+
var contributer = this.getSymbol(augments[i]);
|
198
|
+
if (!contributer && JSDOC.Lang.isBuiltin(''+augments[i])) {
|
199
|
+
contributer = new JSDOC.Symbol("_global_."+augments[i], [], augments[i], new JSDOC.DocComment("Built in."));
|
200
|
+
contributer.isNamespace = true;
|
201
|
+
contributer.srcFile = "";
|
202
|
+
contributer.isPrivate = false;
|
203
|
+
JSDOC.Parser.addSymbol(contributer);
|
204
|
+
}
|
205
|
+
|
206
|
+
if (contributer) {
|
207
|
+
if (contributer.augments.length) {
|
208
|
+
JSDOC.SymbolSet.prototype.walk.apply(this, [contributer]);
|
209
|
+
}
|
210
|
+
|
211
|
+
symbol.inheritsFrom.push(contributer.alias);
|
212
|
+
//if (!isUnique(symbol.inheritsFrom)) {
|
213
|
+
// LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once.");
|
214
|
+
//}
|
215
|
+
//else {
|
216
|
+
var cmethods = contributer.methods;
|
217
|
+
var cproperties = contributer.properties;
|
218
|
+
|
219
|
+
for (var ci = 0, cl = cmethods.length; ci < cl; ci++) {
|
220
|
+
if (!cmethods[ci].isStatic) symbol.inherit(cmethods[ci]);
|
221
|
+
}
|
222
|
+
for (var ci = 0, cl = cproperties.length; ci < cl; ci++) {
|
223
|
+
if (!cproperties[ci].isStatic) symbol.inherit(cproperties[ci]);
|
224
|
+
}
|
225
|
+
//}
|
226
|
+
}
|
227
|
+
else LOG.warn("Can't augment contributer: "+augments[i]+", not found.");
|
228
|
+
}
|
229
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
/**
|
3
|
+
@constructor
|
4
|
+
*/
|
5
|
+
JSDOC.TextStream = function(text) {
|
6
|
+
if (typeof(text) == "undefined") text = "";
|
7
|
+
text = ""+text;
|
8
|
+
this.text = text;
|
9
|
+
this.cursor = 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
JSDOC.TextStream.prototype.look = function(n) {
|
13
|
+
if (typeof n == "undefined") n = 0;
|
14
|
+
|
15
|
+
if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {
|
16
|
+
var result = new String("");
|
17
|
+
result.eof = true;
|
18
|
+
return result;
|
19
|
+
}
|
20
|
+
return this.text.charAt(this.cursor+n);
|
21
|
+
}
|
22
|
+
|
23
|
+
JSDOC.TextStream.prototype.next = function(n) {
|
24
|
+
if (typeof n == "undefined") n = 1;
|
25
|
+
if (n < 1) return null;
|
26
|
+
|
27
|
+
var pulled = "";
|
28
|
+
for (var i = 0; i < n; i++) {
|
29
|
+
if (this.cursor+i < this.text.length) {
|
30
|
+
pulled += this.text.charAt(this.cursor+i);
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
var result = new String("");
|
34
|
+
result.eof = true;
|
35
|
+
return result;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
this.cursor += n;
|
40
|
+
return pulled;
|
41
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
if (typeof JSDOC == "undefined") JSDOC = {};
|
2
|
+
|
3
|
+
/**
|
4
|
+
@constructor
|
5
|
+
*/
|
6
|
+
JSDOC.Token = function(data, type, name) {
|
7
|
+
this.data = data;
|
8
|
+
this.type = type;
|
9
|
+
this.name = name;
|
10
|
+
}
|
11
|
+
|
12
|
+
JSDOC.Token.prototype.toString = function() {
|
13
|
+
return "<"+this.type+" name=\""+this.name+"\">"+this.data+"</"+this.type+">";
|
14
|
+
}
|
15
|
+
|
16
|
+
JSDOC.Token.prototype.is = function(what) {
|
17
|
+
return this.name === what || this.type === what;
|
18
|
+
}
|
@@ -0,0 +1,332 @@
|
|
1
|
+
if (typeof JSDOC == "undefined") JSDOC = {};
|
2
|
+
|
3
|
+
/**
|
4
|
+
@class Search a {@link JSDOC.TextStream} for language tokens.
|
5
|
+
*/
|
6
|
+
JSDOC.TokenReader = function() {
|
7
|
+
this.keepDocs = true;
|
8
|
+
this.keepWhite = false;
|
9
|
+
this.keepComments = false;
|
10
|
+
}
|
11
|
+
|
12
|
+
/**
|
13
|
+
@type {JSDOC.Token[]}
|
14
|
+
*/
|
15
|
+
JSDOC.TokenReader.prototype.tokenize = function(/**JSDOC.TextStream*/stream) {
|
16
|
+
var tokens = [];
|
17
|
+
/**@ignore*/ tokens.last = function() { return tokens[tokens.length-1]; }
|
18
|
+
/**@ignore*/ tokens.lastSym = function() {
|
19
|
+
for (var i = tokens.length-1; i >= 0; i--) {
|
20
|
+
if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i];
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
while (!stream.look().eof) {
|
25
|
+
if (this.read_mlcomment(stream, tokens)) continue;
|
26
|
+
if (this.read_slcomment(stream, tokens)) continue;
|
27
|
+
if (this.read_dbquote(stream, tokens)) continue;
|
28
|
+
if (this.read_snquote(stream, tokens)) continue;
|
29
|
+
if (this.read_regx(stream, tokens)) continue;
|
30
|
+
if (this.read_numb(stream, tokens)) continue;
|
31
|
+
if (this.read_punc(stream, tokens)) continue;
|
32
|
+
if (this.read_newline(stream, tokens)) continue;
|
33
|
+
if (this.read_space(stream, tokens)) continue;
|
34
|
+
if (this.read_word(stream, tokens)) continue;
|
35
|
+
|
36
|
+
// if execution reaches here then an error has happened
|
37
|
+
tokens.push(new JSDOC.Token(stream.next(), "TOKN", "UNKNOWN_TOKEN"));
|
38
|
+
}
|
39
|
+
return tokens;
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
@returns {Boolean} Was the token found?
|
44
|
+
*/
|
45
|
+
JSDOC.TokenReader.prototype.read_word = function(/**JSDOC.TokenStream*/stream, tokens) {
|
46
|
+
var found = "";
|
47
|
+
while (!stream.look().eof && JSDOC.Lang.isWordChar(stream.look())) {
|
48
|
+
found += stream.next();
|
49
|
+
}
|
50
|
+
|
51
|
+
if (found === "") {
|
52
|
+
return false;
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
var name;
|
56
|
+
if ((name = JSDOC.Lang.keyword(found))) tokens.push(new JSDOC.Token(found, "KEYW", name));
|
57
|
+
else tokens.push(new JSDOC.Token(found, "NAME", "NAME"));
|
58
|
+
return true;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
@returns {Boolean} Was the token found?
|
64
|
+
*/
|
65
|
+
JSDOC.TokenReader.prototype.read_punc = function(/**JSDOC.TokenStream*/stream, tokens) {
|
66
|
+
var found = "";
|
67
|
+
var name;
|
68
|
+
while (!stream.look().eof && JSDOC.Lang.punc(found+stream.look())) {
|
69
|
+
found += stream.next();
|
70
|
+
}
|
71
|
+
|
72
|
+
if (found === "") {
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
tokens.push(new JSDOC.Token(found, "PUNC", JSDOC.Lang.punc(found)));
|
77
|
+
return true;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
@returns {Boolean} Was the token found?
|
83
|
+
*/
|
84
|
+
JSDOC.TokenReader.prototype.read_space = function(/**JSDOC.TokenStream*/stream, tokens) {
|
85
|
+
var found = "";
|
86
|
+
|
87
|
+
while (!stream.look().eof && JSDOC.Lang.isSpace(stream.look())) {
|
88
|
+
found += stream.next();
|
89
|
+
}
|
90
|
+
|
91
|
+
if (found === "") {
|
92
|
+
return false;
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
if (this.collapseWhite) found = " ";
|
96
|
+
if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "SPACE"));
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
@returns {Boolean} Was the token found?
|
103
|
+
*/
|
104
|
+
JSDOC.TokenReader.prototype.read_newline = function(/**JSDOC.TokenStream*/stream, tokens) {
|
105
|
+
var found = "";
|
106
|
+
|
107
|
+
while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look())) {
|
108
|
+
found += stream.next();
|
109
|
+
}
|
110
|
+
|
111
|
+
if (found === "") {
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
else {
|
115
|
+
if (this.collapseWhite) found = "\n";
|
116
|
+
if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "NEWLINE"));
|
117
|
+
return true;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
@returns {Boolean} Was the token found?
|
123
|
+
*/
|
124
|
+
JSDOC.TokenReader.prototype.read_mlcomment = function(/**JSDOC.TokenStream*/stream, tokens) {
|
125
|
+
if (stream.look() == "/" && stream.look(1) == "*") {
|
126
|
+
var found = stream.next(2);
|
127
|
+
|
128
|
+
while (!stream.look().eof && !(stream.look(-1) == "/" && stream.look(-2) == "*")) {
|
129
|
+
found += stream.next();
|
130
|
+
}
|
131
|
+
|
132
|
+
// to start doclet we allow /** or /*** but not /**/ or /****
|
133
|
+
if (/^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) tokens.push(new JSDOC.Token(found, "COMM", "JSDOC"));
|
134
|
+
else if (this.keepComments) tokens.push(new JSDOC.Token(found, "COMM", "MULTI_LINE_COMM"));
|
135
|
+
return true;
|
136
|
+
}
|
137
|
+
return false;
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
@returns {Boolean} Was the token found?
|
142
|
+
*/
|
143
|
+
JSDOC.TokenReader.prototype.read_slcomment = function(/**JSDOC.TokenStream*/stream, tokens) {
|
144
|
+
var found;
|
145
|
+
if (
|
146
|
+
(stream.look() == "/" && stream.look(1) == "/" && (found=stream.next(2)))
|
147
|
+
||
|
148
|
+
(stream.look() == "<" && stream.look(1) == "!" && stream.look(2) == "-" && stream.look(3) == "-" && (found=stream.next(4)))
|
149
|
+
) {
|
150
|
+
|
151
|
+
while (!stream.look().eof && !JSDOC.Lang.isNewline(stream.look())) {
|
152
|
+
found += stream.next();
|
153
|
+
}
|
154
|
+
|
155
|
+
if (this.keepComments) {
|
156
|
+
tokens.push(new JSDOC.Token(found, "COMM", "SINGLE_LINE_COMM"));
|
157
|
+
}
|
158
|
+
return true;
|
159
|
+
}
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
|
163
|
+
/**
|
164
|
+
@returns {Boolean} Was the token found?
|
165
|
+
*/
|
166
|
+
JSDOC.TokenReader.prototype.read_dbquote = function(/**JSDOC.TokenStream*/stream, tokens) {
|
167
|
+
if (stream.look() == "\"") {
|
168
|
+
// find terminator
|
169
|
+
var string = stream.next();
|
170
|
+
|
171
|
+
while (!stream.look().eof) {
|
172
|
+
if (stream.look() == "\\") {
|
173
|
+
if (JSDOC.Lang.isNewline(stream.look(1))) {
|
174
|
+
do {
|
175
|
+
stream.next();
|
176
|
+
} while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look()));
|
177
|
+
string += "\\\n";
|
178
|
+
}
|
179
|
+
else {
|
180
|
+
string += stream.next(2);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
else if (stream.look() == "\"") {
|
184
|
+
string += stream.next();
|
185
|
+
tokens.push(new JSDOC.Token(string, "STRN", "DOUBLE_QUOTE"));
|
186
|
+
return true;
|
187
|
+
}
|
188
|
+
else {
|
189
|
+
string += stream.next();
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
return false; // error! unterminated string
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
@returns {Boolean} Was the token found?
|
198
|
+
*/
|
199
|
+
JSDOC.TokenReader.prototype.read_snquote = function(/**JSDOC.TokenStream*/stream, tokens) {
|
200
|
+
if (stream.look() == "'") {
|
201
|
+
// find terminator
|
202
|
+
var string = stream.next();
|
203
|
+
|
204
|
+
while (!stream.look().eof) {
|
205
|
+
if (stream.look() == "\\") { // escape sequence
|
206
|
+
string += stream.next(2);
|
207
|
+
}
|
208
|
+
else if (stream.look() == "'") {
|
209
|
+
string += stream.next();
|
210
|
+
tokens.push(new JSDOC.Token(string, "STRN", "SINGLE_QUOTE"));
|
211
|
+
return true;
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
string += stream.next();
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
return false; // error! unterminated string
|
219
|
+
}
|
220
|
+
|
221
|
+
/**
|
222
|
+
@returns {Boolean} Was the token found?
|
223
|
+
*/
|
224
|
+
JSDOC.TokenReader.prototype.read_numb = function(/**JSDOC.TokenStream*/stream, tokens) {
|
225
|
+
if (stream.look() === "0" && stream.look(1) == "x") {
|
226
|
+
return this.read_hex(stream, tokens);
|
227
|
+
}
|
228
|
+
|
229
|
+
var found = "";
|
230
|
+
|
231
|
+
while (!stream.look().eof && JSDOC.Lang.isNumber(found+stream.look())){
|
232
|
+
found += stream.next();
|
233
|
+
}
|
234
|
+
|
235
|
+
if (found === "") {
|
236
|
+
return false;
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
if (/^0[0-7]/.test(found)) tokens.push(new JSDOC.Token(found, "NUMB", "OCTAL"));
|
240
|
+
else tokens.push(new JSDOC.Token(found, "NUMB", "DECIMAL"));
|
241
|
+
return true;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
/*t:
|
245
|
+
requires("../lib/JSDOC/TextStream.js");
|
246
|
+
requires("../lib/JSDOC/Token.js");
|
247
|
+
requires("../lib/JSDOC/Lang.js");
|
248
|
+
|
249
|
+
plan(3, "testing JSDOC.TokenReader.prototype.read_numb");
|
250
|
+
|
251
|
+
//// setup
|
252
|
+
var src = "function foo(num){while (num+8.0 >= 0x20 && num < 0777){}}";
|
253
|
+
var tr = new JSDOC.TokenReader();
|
254
|
+
var tokens = tr.tokenize(new JSDOC.TextStream(src));
|
255
|
+
|
256
|
+
var hexToken, octToken, decToken;
|
257
|
+
for (var i = 0; i < tokens.length; i++) {
|
258
|
+
if (tokens[i].name == "HEX_DEC") hexToken = tokens[i];
|
259
|
+
if (tokens[i].name == "OCTAL") octToken = tokens[i];
|
260
|
+
if (tokens[i].name == "DECIMAL") decToken = tokens[i];
|
261
|
+
}
|
262
|
+
////
|
263
|
+
|
264
|
+
is(decToken.data, "8.0", "decimal number is found in source.");
|
265
|
+
is(hexToken.data, "0x20", "hexdec number is found in source (issue #99).");
|
266
|
+
is(octToken.data, "0777", "octal number is found in source.");
|
267
|
+
*/
|
268
|
+
|
269
|
+
/**
|
270
|
+
@returns {Boolean} Was the token found?
|
271
|
+
*/
|
272
|
+
JSDOC.TokenReader.prototype.read_hex = function(/**JSDOC.TokenStream*/stream, tokens) {
|
273
|
+
var found = stream.next(2);
|
274
|
+
|
275
|
+
while (!stream.look().eof) {
|
276
|
+
if (JSDOC.Lang.isHexDec(found) && !JSDOC.Lang.isHexDec(found+stream.look())) { // done
|
277
|
+
tokens.push(new JSDOC.Token(found, "NUMB", "HEX_DEC"));
|
278
|
+
return true;
|
279
|
+
}
|
280
|
+
else {
|
281
|
+
found += stream.next();
|
282
|
+
}
|
283
|
+
}
|
284
|
+
return false;
|
285
|
+
}
|
286
|
+
|
287
|
+
/**
|
288
|
+
@returns {Boolean} Was the token found?
|
289
|
+
*/
|
290
|
+
JSDOC.TokenReader.prototype.read_regx = function(/**JSDOC.TokenStream*/stream, tokens) {
|
291
|
+
var last;
|
292
|
+
if (
|
293
|
+
stream.look() == "/"
|
294
|
+
&&
|
295
|
+
(
|
296
|
+
|
297
|
+
(
|
298
|
+
!(last = tokens.lastSym()) // there is no last, the regex is the first symbol
|
299
|
+
||
|
300
|
+
(
|
301
|
+
!last.is("NUMB")
|
302
|
+
&& !last.is("NAME")
|
303
|
+
&& !last.is("RIGHT_PAREN")
|
304
|
+
&& !last.is("RIGHT_BRACKET")
|
305
|
+
)
|
306
|
+
)
|
307
|
+
)
|
308
|
+
) {
|
309
|
+
var regex = stream.next();
|
310
|
+
|
311
|
+
while (!stream.look().eof) {
|
312
|
+
if (stream.look() == "\\") { // escape sequence
|
313
|
+
regex += stream.next(2);
|
314
|
+
}
|
315
|
+
else if (stream.look() == "/") {
|
316
|
+
regex += stream.next();
|
317
|
+
|
318
|
+
while (/[gmi]/.test(stream.look())) {
|
319
|
+
regex += stream.next();
|
320
|
+
}
|
321
|
+
|
322
|
+
tokens.push(new JSDOC.Token(regex, "REGX", "REGX"));
|
323
|
+
return true;
|
324
|
+
}
|
325
|
+
else {
|
326
|
+
regex += stream.next();
|
327
|
+
}
|
328
|
+
}
|
329
|
+
// error: unterminated regex
|
330
|
+
}
|
331
|
+
return false;
|
332
|
+
}
|