jsdoc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/VERSION +1 -0
- data/bin/jsdoc +5 -0
- data/jsdoc.gemspec +162 -0
- data/lib/jsdoc-toolkit-2.4.0/README.txt +183 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame.js +33 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Chain.js +102 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Dumper.js +144 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Hash.js +84 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Link.js +173 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Namespace.js +10 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Opt.js +134 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Reflection.js +26 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/String.js +93 -0
- data/lib/jsdoc-toolkit-2.4.0/app/frame/Testrun.js +129 -0
- data/lib/jsdoc-toolkit-2.4.0/app/handlers/FOODOC.js +26 -0
- data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC.js +26 -0
- data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC/DomReader.js +159 -0
- data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC.js +106 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/DocComment.js +204 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/DocTag.js +294 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/JsDoc.js +140 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/JsPlate.js +109 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Lang.js +144 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Parser.js +146 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/PluginManager.js +33 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Symbol.js +644 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/SymbolSet.js +243 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/TextStream.js +41 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Token.js +18 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/TokenReader.js +332 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/TokenStream.js +133 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Util.js +32 -0
- data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Walker.js +507 -0
- data/lib/jsdoc-toolkit-2.4.0/app/main.js +111 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/commentSrcJson.js +20 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/frameworkPrototype.js +16 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/functionCall.js +10 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/publishSrcHilite.js +62 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/symbolLink.js +10 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/tagParamConfig.js +31 -0
- data/lib/jsdoc-toolkit-2.4.0/app/plugins/tagSynonyms.js +43 -0
- data/lib/jsdoc-toolkit-2.4.0/app/run.js +348 -0
- data/lib/jsdoc-toolkit-2.4.0/app/t/TestDoc.js +144 -0
- data/lib/jsdoc-toolkit-2.4.0/app/t/runner.js +13 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test.js +342 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/addon.js +24 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/anon_inner.js +14 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/augments.js +31 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/augments2.js +26 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/borrows.js +46 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/borrows2.js +23 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/config.js +22 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/constructs.js +18 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/encoding.js +10 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/encoding_other.js +12 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/event.js +54 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/exports.js +14 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/functions_anon.js +39 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/functions_nested.js +33 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/global.js +13 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/globals.js +25 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/ignore.js +10 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/inner.js +16 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/jsdoc_test.js +477 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/lend.js +33 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/memberof.js +19 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/memberof2.js +38 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/memberof3.js +33 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/memberof_constructor.js +17 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/module.js +17 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/multi_methods.js +25 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/name.js +19 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/namespace_nested.js +23 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/nocode.js +13 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/oblit_anon.js +20 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/overview.js +20 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/param_inline.js +37 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/params_optional.js +8 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/prototype.js +17 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/prototype_nested.js +9 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/prototype_oblit.js +13 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/prototype_oblit_constructor.js +24 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/public.js +10 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/scripts/code.js +5 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/scripts/notcode.txt +5 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/shared.js +42 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/shared2.js +2 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/shortcuts.js +22 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/static_this.js +13 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/synonyms.js +31 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/tosource.js +23 -0
- data/lib/jsdoc-toolkit-2.4.0/app/test/variable_redefine.js +14 -0
- data/lib/jsdoc-toolkit-2.4.0/changes.txt +124 -0
- data/lib/jsdoc-toolkit-2.4.0/conf/sample.conf +31 -0
- data/lib/jsdoc-toolkit-2.4.0/java/build.xml +36 -0
- data/lib/jsdoc-toolkit-2.4.0/java/build_1.4.xml +36 -0
- data/lib/jsdoc-toolkit-2.4.0/java/classes/js.jar +0 -0
- data/lib/jsdoc-toolkit-2.4.0/java/src/JsDebugRun.java +21 -0
- data/lib/jsdoc-toolkit-2.4.0/java/src/JsRun.java +21 -0
- data/lib/jsdoc-toolkit-2.4.0/jsdebug.jar +0 -0
- data/lib/jsdoc-toolkit-2.4.0/jsrun.jar +0 -0
- data/lib/jsdoc-toolkit-2.4.0/jsrun.sh +52 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/allclasses.tmpl +17 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/allfiles.tmpl +56 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/class.tmpl +649 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/index.tmpl +39 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/publish.js +201 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/static/default.css +162 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/static/header.html +2 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/static/index.html +19 -0
- data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/symbol.tmpl +35 -0
- data/lib/jsdoc.rb +23 -0
- data/test/helper.rb +10 -0
- data/test/test_jsdoc.rb +7 -0
- metadata +199 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LOG.inform("XMLDOC.symbolize loaded");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Convert the source file to a set of symbols
|
|
5
|
+
*/
|
|
6
|
+
XMLDOC.symbolize = function(srcFile, src) {
|
|
7
|
+
|
|
8
|
+
LOG.inform("Symbolizing file '" + srcFile + "'");
|
|
9
|
+
|
|
10
|
+
// XML files already have a defined structure, so we don't need to
|
|
11
|
+
// do anything but parse them. The DOM reader can create a symbol
|
|
12
|
+
// table from the parsed XML.
|
|
13
|
+
var dr = new XMLDOC.DomReader(XMLDOC.Parser.parse(src));
|
|
14
|
+
return dr.getSymbols(srcFile);
|
|
15
|
+
|
|
16
|
+
};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
LOG.inform("XMLDOC.Parser loaded");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* XML Parser object. Returns an {@link #XMLDOC.Parser.node} which is
|
|
5
|
+
* the root element of the parsed document.
|
|
6
|
+
* <p/>
|
|
7
|
+
* By default, this parser will only handle well formed XML. To
|
|
8
|
+
* allow the parser to handle HTML, set the <tt>XMLDOC.Parser.strictMode</tt>
|
|
9
|
+
* variable to <tt>false</tt> before calling <tt>XMLDOC.Parser.parse()</tt>.
|
|
10
|
+
* <p/>
|
|
11
|
+
* <i>Note: If you pass poorly formed XML, it will cause the parser to throw
|
|
12
|
+
* an exception.</i>
|
|
13
|
+
*
|
|
14
|
+
* @author Brett Fattori (bfattori@fry.com)
|
|
15
|
+
* @author $Author: micmath $
|
|
16
|
+
* @version $Revision: 497 $
|
|
17
|
+
*/
|
|
18
|
+
XMLDOC.Parser = {};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Strict mode setting. Setting this to false allows HTML-style source to
|
|
22
|
+
* be parsed. Normally, well formed XML has defined end tags, or empty tags
|
|
23
|
+
* are properly formed. Default: <tt>true</tt>
|
|
24
|
+
* @type Boolean
|
|
25
|
+
*/
|
|
26
|
+
XMLDOC.Parser.strictMode = true;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A node in an XML Document. Node types are ROOT, ELEMENT, COMMENT, PI, and TEXT.
|
|
30
|
+
* @param parent {XMLDOC.Parser.node} The parent node
|
|
31
|
+
* @param name {String} The node name
|
|
32
|
+
* @param type {String} One of the types
|
|
33
|
+
*/
|
|
34
|
+
XMLDOC.Parser.node = function(parent, name, type)
|
|
35
|
+
{
|
|
36
|
+
this.name = name;
|
|
37
|
+
this.type = type || "ELEMENT";
|
|
38
|
+
this.parent = parent;
|
|
39
|
+
this.charData = "";
|
|
40
|
+
this.attrs = {};
|
|
41
|
+
this.nodes = [];
|
|
42
|
+
this.cPtr = 0;
|
|
43
|
+
|
|
44
|
+
XMLDOC.Parser.node.prototype.getAttributeNames = function() {
|
|
45
|
+
var a = [];
|
|
46
|
+
for (var o in this.attrs)
|
|
47
|
+
{
|
|
48
|
+
a.push(o);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return a;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
XMLDOC.Parser.node.prototype.getAttribute = function(attr) {
|
|
55
|
+
return this.attrs[attr];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
XMLDOC.Parser.node.prototype.setAttribute = function(attr, val) {
|
|
59
|
+
this.attrs[attr] = val;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
XMLDOC.Parser.node.prototype.getChild = function(idx) {
|
|
63
|
+
return this.nodes[idx];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
XMLDOC.Parser.node.prototype.parentNode = function() {
|
|
67
|
+
return this.parent;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
XMLDOC.Parser.node.prototype.firstChild = function() {
|
|
71
|
+
return this.nodes[0];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
XMLDOC.Parser.node.prototype.lastChild = function() {
|
|
75
|
+
return this.nodes[this.nodes.length - 1];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
XMLDOC.Parser.node.prototype.nextSibling = function() {
|
|
79
|
+
var p = this.parent;
|
|
80
|
+
if (p && (p.nodes.indexOf(this) + 1 != p.nodes.length))
|
|
81
|
+
{
|
|
82
|
+
return p.getChild(p.nodes.indexOf(this) + 1);
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
XMLDOC.Parser.node.prototype.prevSibling = function() {
|
|
88
|
+
var p = this.parent;
|
|
89
|
+
if (p && (p.nodes.indexOf(this) - 1 >= 0))
|
|
90
|
+
{
|
|
91
|
+
return p.getChild(p.nodes.indexOf(this) - 1);
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Parse an XML Document from the specified source. The XML should be
|
|
99
|
+
* well formed, unless strict mode is disabled, then the parser will
|
|
100
|
+
* handle HTML-style XML documents.
|
|
101
|
+
* @param src {String} The source to parse
|
|
102
|
+
*/
|
|
103
|
+
XMLDOC.Parser.parse = function(src)
|
|
104
|
+
{
|
|
105
|
+
var A = [];
|
|
106
|
+
|
|
107
|
+
// Normailize whitespace
|
|
108
|
+
A = src.split("\r\n");
|
|
109
|
+
src = A.join("\n");
|
|
110
|
+
A = src.split("\r");
|
|
111
|
+
src = A.join("\n");
|
|
112
|
+
|
|
113
|
+
// Remove XML and DOCTYPE specifier
|
|
114
|
+
src.replace(/<\?XML .*\?>/i, "");
|
|
115
|
+
src.replace(/<!DOCTYPE .*\>/i, "");
|
|
116
|
+
|
|
117
|
+
// The document is the root node and cannot be modified or removed
|
|
118
|
+
var doc = new XMLDOC.Parser.node(null, "ROOT", "DOCUMENT");
|
|
119
|
+
|
|
120
|
+
// Let's break it down
|
|
121
|
+
XMLDOC.Parser.eat(doc, src);
|
|
122
|
+
|
|
123
|
+
return doc;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The XML fragment processing routine. This method is private and should not be called
|
|
128
|
+
* directly.
|
|
129
|
+
* @param parentNode {XMLDOC.Parser.node} The node which is the parent of this fragment
|
|
130
|
+
* @param src {String} The source within the fragment to process
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
XMLDOC.Parser.eat = function(parentNode, src)
|
|
134
|
+
{
|
|
135
|
+
// A simple tag def
|
|
136
|
+
var reTag = new RegExp("<(!|)(\\?|--|)((.|\\s)*?)\\2>","g");
|
|
137
|
+
|
|
138
|
+
// Special tag types
|
|
139
|
+
var reCommentTag = /<!--((.|\s)*?)-->/;
|
|
140
|
+
var rePITag = /<\?((.|\s)*?)\?>/;
|
|
141
|
+
|
|
142
|
+
// A start tag (with potential empty marker)
|
|
143
|
+
var reStartTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*(\/)?>/;
|
|
144
|
+
|
|
145
|
+
// An empty HTML style tag (not proper XML, but we'll accept it so we can process HTML)
|
|
146
|
+
var reHTMLEmptyTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*>/;
|
|
147
|
+
|
|
148
|
+
// Fully enclosing tag with nested tags
|
|
149
|
+
var reEnclosingTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*?)\4)*>((.|\s)*?)<\/\1>/;
|
|
150
|
+
|
|
151
|
+
// Breaks down attributes
|
|
152
|
+
var reAttributes = new RegExp(" +([\\w_\\-]*)=(\"|')(.*?)\\2","g");
|
|
153
|
+
|
|
154
|
+
// Find us a tag
|
|
155
|
+
var tag;
|
|
156
|
+
while ((tag = reTag.exec(src)) != null)
|
|
157
|
+
{
|
|
158
|
+
if (tag.index > 0)
|
|
159
|
+
{
|
|
160
|
+
// The next tag has some text before it
|
|
161
|
+
var text = src.substring(0, tag.index).replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
|
|
162
|
+
|
|
163
|
+
if (text.length > 0 && (text != "\n"))
|
|
164
|
+
{
|
|
165
|
+
var txtnode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
|
|
166
|
+
txtnode.charData = text;
|
|
167
|
+
|
|
168
|
+
// Append the new text node
|
|
169
|
+
parentNode.nodes.push(txtnode);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Reset the lastIndex of reTag
|
|
173
|
+
reTag.lastIndex -= src.substring(0, tag.index).length;
|
|
174
|
+
|
|
175
|
+
// Eat the text
|
|
176
|
+
src = src.substring(tag.index);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (reCommentTag.test(tag[0]))
|
|
180
|
+
{
|
|
181
|
+
// Is this a comment?
|
|
182
|
+
var comment = new XMLDOC.Parser.node(parentNode, "", "COMMENT");
|
|
183
|
+
comment.charData = reCommentTag.exec(tag[0])[1];
|
|
184
|
+
|
|
185
|
+
// Append the comment
|
|
186
|
+
parentNode.nodes.push(comment);
|
|
187
|
+
|
|
188
|
+
// Move the lastIndex of reTag
|
|
189
|
+
reTag.lastIndex -= tag[0].length;
|
|
190
|
+
|
|
191
|
+
// Eat the tag
|
|
192
|
+
src = src.replace(reCommentTag, "");
|
|
193
|
+
}
|
|
194
|
+
else if (rePITag.test(tag[0]))
|
|
195
|
+
{
|
|
196
|
+
// Is this a processing instruction?
|
|
197
|
+
var pi = new XMLDOC.Parser.node(parentNode, "", "PI");
|
|
198
|
+
pi.charData = rePITag.exec(tag[0])[1];
|
|
199
|
+
|
|
200
|
+
// Append the processing instruction
|
|
201
|
+
parentNode.nodes.push(pi);
|
|
202
|
+
|
|
203
|
+
// Move the lastIndex of reTag
|
|
204
|
+
reTag.lastIndex -= tag[0].length;
|
|
205
|
+
|
|
206
|
+
// Eat the tag
|
|
207
|
+
src = src.replace(rePITag, "");
|
|
208
|
+
}
|
|
209
|
+
else if (reStartTag.test(tag[0]))
|
|
210
|
+
{
|
|
211
|
+
// Break it down
|
|
212
|
+
var e = reStartTag.exec(tag[0]);
|
|
213
|
+
var elem = new XMLDOC.Parser.node(parentNode, e[1], "ELEMENT");
|
|
214
|
+
|
|
215
|
+
// Get attributes from the tag
|
|
216
|
+
var a;
|
|
217
|
+
while ((a = reAttributes.exec(e[2])) != null )
|
|
218
|
+
{
|
|
219
|
+
elem.attrs[a[1]] = a[3];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Is this an empty XML-style tag?
|
|
223
|
+
if (e[6] == "/")
|
|
224
|
+
{
|
|
225
|
+
// Append the empty element
|
|
226
|
+
parentNode.nodes.push(elem);
|
|
227
|
+
|
|
228
|
+
// Move the lastIndex of reTag (include the start tag length)
|
|
229
|
+
reTag.lastIndex -= e[0].length;
|
|
230
|
+
|
|
231
|
+
// Eat the tag
|
|
232
|
+
src = src.replace(reStartTag, "");
|
|
233
|
+
}
|
|
234
|
+
else
|
|
235
|
+
{
|
|
236
|
+
// Check for malformed XML tags
|
|
237
|
+
var htmlParsed = false;
|
|
238
|
+
var htmlStartTag = reHTMLEmptyTag.exec(src);
|
|
239
|
+
|
|
240
|
+
// See if there isn't an end tag within this block
|
|
241
|
+
var reHTMLEndTag = new RegExp("</" + htmlStartTag[1] + ">");
|
|
242
|
+
var htmlEndTag = reHTMLEndTag.exec(src);
|
|
243
|
+
|
|
244
|
+
if (XMLDOC.Parser.strictMode && htmlEndTag == null)
|
|
245
|
+
{
|
|
246
|
+
// Poorly formed XML fails in strict mode
|
|
247
|
+
var err = new Error("Malformed XML passed to XMLDOC.Parser... Error contains malformed 'src'");
|
|
248
|
+
err.src = src;
|
|
249
|
+
throw err;
|
|
250
|
+
}
|
|
251
|
+
else if (htmlEndTag == null)
|
|
252
|
+
{
|
|
253
|
+
// This is an HTML-style empty tag, store the element for it in non-strict mode
|
|
254
|
+
parentNode.nodes.push(elem);
|
|
255
|
+
|
|
256
|
+
// Eat the tag
|
|
257
|
+
src = src.replace(reHTMLEmptyTag, "");
|
|
258
|
+
htmlParsed = true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// If we didn't parse HTML-style, it must be an enclosing tag
|
|
262
|
+
if (!htmlParsed)
|
|
263
|
+
{
|
|
264
|
+
var enc = reEnclosingTag.exec(src);
|
|
265
|
+
|
|
266
|
+
// Go deeper into the document
|
|
267
|
+
XMLDOC.Parser.eat(elem, enc[6]);
|
|
268
|
+
|
|
269
|
+
// Append the new element node
|
|
270
|
+
parentNode.nodes.push(elem);
|
|
271
|
+
|
|
272
|
+
// Eat the tag
|
|
273
|
+
src = src.replace(reEnclosingTag, "");
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Reset the lastIndex of reTag
|
|
278
|
+
reTag.lastIndex = 0;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// No tag was found... append the text if there is any
|
|
283
|
+
src = src.replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
|
|
284
|
+
if (src.length > 0 && (src != "\n"))
|
|
285
|
+
{
|
|
286
|
+
var txtNode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
|
|
287
|
+
txtNode.charData = src;
|
|
288
|
+
|
|
289
|
+
// Append the new text node
|
|
290
|
+
parentNode.nodes.push(txtNode);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@overview
|
|
3
|
+
@date $Date: 2010-06-13 22:02:44 +0100 (Sun, 13 Jun 2010) $
|
|
4
|
+
@version $Revision: 837 $
|
|
5
|
+
@location $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-2.4.0/jsdoc-toolkit/app/lib/JSDOC.js $
|
|
6
|
+
@name JSDOC.js
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
This is the main container for the JSDOC application.
|
|
11
|
+
@namespace
|
|
12
|
+
*/
|
|
13
|
+
JSDOC = {
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
@requires Opt
|
|
18
|
+
*/
|
|
19
|
+
if (typeof arguments == "undefined") arguments = [];
|
|
20
|
+
JSDOC.opt = Opt.get(
|
|
21
|
+
arguments,
|
|
22
|
+
{
|
|
23
|
+
a: "allfunctions",
|
|
24
|
+
c: "conf",
|
|
25
|
+
d: "directory",
|
|
26
|
+
"D[]": "define",
|
|
27
|
+
e: "encoding",
|
|
28
|
+
"E[]": "exclude",
|
|
29
|
+
h: "help",
|
|
30
|
+
m: "multiple",
|
|
31
|
+
n: "nocode",
|
|
32
|
+
o: "out",
|
|
33
|
+
p: "private",
|
|
34
|
+
q: "quiet",
|
|
35
|
+
r: "recurse",
|
|
36
|
+
S: "securemodules",
|
|
37
|
+
s: "suppress",
|
|
38
|
+
t: "template",
|
|
39
|
+
T: "testmode",
|
|
40
|
+
u: "unique",
|
|
41
|
+
v: "verbose",
|
|
42
|
+
x: "ext"
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
/** The current version string of this application. */
|
|
47
|
+
JSDOC.VERSION = "2.4.0";
|
|
48
|
+
|
|
49
|
+
/** Print out usage information and quit. */
|
|
50
|
+
JSDOC.usage = function() {
|
|
51
|
+
print("USAGE: java -jar jsrun.jar app/run.js [OPTIONS] <SRC_DIR> <SRC_FILE> ...");
|
|
52
|
+
print("");
|
|
53
|
+
print("OPTIONS:");
|
|
54
|
+
print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n");
|
|
55
|
+
print(" -c or --conf\n Load a configuration file.\n");
|
|
56
|
+
print(" -d=<PATH> or --directory=<PATH>\n Output to this directory (defaults to \"out\").\n");
|
|
57
|
+
print(" -D=\"myVar:My value\" or --define=\"myVar:My value\"\n Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar.\n");
|
|
58
|
+
print(" -e=<ENCODING> or --encoding=<ENCODING>\n Use this encoding to read and write files.\n");
|
|
59
|
+
print(" -E=\"REGEX\" or --exclude=\"REGEX\"\n Multiple. Exclude files based on the supplied regex.\n");
|
|
60
|
+
print(" -h or --help\n Show this message and exit.\n");
|
|
61
|
+
print(" -m or --multiples\n Don't warn about symbols being documented more than once.\n");
|
|
62
|
+
print(" -n or --nocode\n Ignore all code, only document comments with @name tags.\n");
|
|
63
|
+
print(" -o=<PATH> or --out=<PATH>\n Print log messages to a file (defaults to stdout).\n");
|
|
64
|
+
print(" -p or --private\n Include symbols tagged as private, underscored and inner symbols.\n");
|
|
65
|
+
print(" -q or --quiet\n Do not output any messages, not even warnings.\n");
|
|
66
|
+
print(" -r=<DEPTH> or --recurse=<DEPTH>\n Descend into src directories.\n");
|
|
67
|
+
print(" -s or --suppress\n Suppress source code output.\n");
|
|
68
|
+
print(" -S or --securemodules\n Use Secure Modules mode to parse source code.\n");
|
|
69
|
+
print(" -t=<PATH> or --template=<PATH>\n Required. Use this template to format the output.\n");
|
|
70
|
+
print(" -T or --test\n Run all unit tests and exit.\n");
|
|
71
|
+
print(" -u or --unique\n Force file names to be unique, but not based on symbol names.\n");
|
|
72
|
+
print(" -v or --verbose\n Provide verbose feedback about what is happening.\n");
|
|
73
|
+
print(" -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...\n Scan source files with the given extension/s (defaults to js).\n");
|
|
74
|
+
|
|
75
|
+
quit();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*t:
|
|
79
|
+
plan(4, "Testing JSDOC namespace.");
|
|
80
|
+
|
|
81
|
+
is(
|
|
82
|
+
typeof JSDOC,
|
|
83
|
+
"object",
|
|
84
|
+
"JSDOC.usage is a function."
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
is(
|
|
88
|
+
typeof JSDOC.VERSION,
|
|
89
|
+
"string",
|
|
90
|
+
"JSDOC.VERSION is a string."
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
is(
|
|
94
|
+
typeof JSDOC.usage,
|
|
95
|
+
"function",
|
|
96
|
+
"JSDOC.usage is a function."
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
is(
|
|
100
|
+
typeof JSDOC.opt,
|
|
101
|
+
"object",
|
|
102
|
+
"JSDOC.opt is a object."
|
|
103
|
+
);
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
if (this.IO) IO.includeDir("lib/JSDOC/");
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
if (typeof JSDOC == "undefined") JSDOC = {};
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Create a new DocComment. This takes a raw documentation comment,
|
|
5
|
+
and wraps it in useful accessors.
|
|
6
|
+
@class Represents a documentation comment object.
|
|
7
|
+
*/
|
|
8
|
+
JSDOC.DocComment = function(/**String*/comment) {
|
|
9
|
+
this.init();
|
|
10
|
+
if (typeof comment != "undefined") {
|
|
11
|
+
this.parse(comment);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
JSDOC.DocComment.prototype.init = function() {
|
|
16
|
+
this.isUserComment = true;
|
|
17
|
+
this.src = "";
|
|
18
|
+
this.meta = "";
|
|
19
|
+
this.tagTexts = [];
|
|
20
|
+
this.tags = [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
@requires JSDOC.DocTag
|
|
25
|
+
*/
|
|
26
|
+
JSDOC.DocComment.prototype.parse = function(/**String*/comment) {
|
|
27
|
+
if (comment == "") {
|
|
28
|
+
comment = "/** @desc */";
|
|
29
|
+
this.isUserComment = false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
this.src = JSDOC.DocComment.unwrapComment(comment);
|
|
33
|
+
|
|
34
|
+
this.meta = "";
|
|
35
|
+
if (this.src.indexOf("#") == 0) {
|
|
36
|
+
this.src.match(/#(.+[+-])([\s\S]*)$/);
|
|
37
|
+
if (RegExp.$1) this.meta = RegExp.$1;
|
|
38
|
+
if (RegExp.$2) this.src = RegExp.$2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof JSDOC.PluginManager != "undefined") {
|
|
42
|
+
JSDOC.PluginManager.run("onDocCommentSrc", this);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this.fixDesc();
|
|
46
|
+
|
|
47
|
+
this.src = JSDOC.DocComment.shared+"\n"+this.src;
|
|
48
|
+
|
|
49
|
+
this.tagTexts =
|
|
50
|
+
this.src
|
|
51
|
+
.split(/(^|[\r\n])\s*@/)
|
|
52
|
+
.filter(function($){return $.match(/\S/)});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
The tags found in the comment.
|
|
56
|
+
@type JSDOC.DocTag[]
|
|
57
|
+
*/
|
|
58
|
+
this.tags = this.tagTexts.map(function($){return new JSDOC.DocTag($)});
|
|
59
|
+
|
|
60
|
+
if (typeof JSDOC.PluginManager != "undefined") {
|
|
61
|
+
JSDOC.PluginManager.run("onDocCommentTags", this);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*t:
|
|
66
|
+
plan(5, "testing JSDOC.DocComment");
|
|
67
|
+
requires("../frame/String.js");
|
|
68
|
+
requires("../lib/JSDOC/DocTag.js");
|
|
69
|
+
|
|
70
|
+
var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
|
|
71
|
+
is(com.tagTexts[0], "foo some\ncomment here", "first tag text is found.");
|
|
72
|
+
is(com.tags[0].title, "foo", "the title is found in a comment with one tag.");
|
|
73
|
+
|
|
74
|
+
var com = new JSDOC.DocComment("/** @foo first\n* @bar second*"+"/");
|
|
75
|
+
is(com.getTag("bar").length, 1, "getTag() returns one tag by that title.");
|
|
76
|
+
|
|
77
|
+
JSDOC.DocComment.shared = "@author John Smith";
|
|
78
|
+
var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
|
|
79
|
+
is(com.tags[0].title, "author", "shared comment is added.");
|
|
80
|
+
is(com.tags[1].title, "foo", "shared comment is added to existing tag.");
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
If no @desc tag is provided, this function will add it.
|
|
85
|
+
*/
|
|
86
|
+
JSDOC.DocComment.prototype.fixDesc = function() {
|
|
87
|
+
if (this.meta && this.meta != "@+") return;
|
|
88
|
+
if (/^\s*[^@\s]/.test(this.src)) {
|
|
89
|
+
this.src = "@desc "+this.src;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*t:
|
|
94
|
+
plan(5, "testing JSDOC.DocComment#fixDesc");
|
|
95
|
+
|
|
96
|
+
var com = new JSDOC.DocComment();
|
|
97
|
+
|
|
98
|
+
com.src = "this is a desc\n@author foo";
|
|
99
|
+
com.fixDesc();
|
|
100
|
+
is(com.src, "@desc this is a desc\n@author foo", "if no @desc tag is provided one is added.");
|
|
101
|
+
|
|
102
|
+
com.src = "x";
|
|
103
|
+
com.fixDesc();
|
|
104
|
+
is(com.src, "@desc x", "if no @desc tag is provided one is added to a single character.");
|
|
105
|
+
|
|
106
|
+
com.src = "\nx";
|
|
107
|
+
com.fixDesc();
|
|
108
|
+
is(com.src, "@desc \nx", "if no @desc tag is provided one is added to return and character.");
|
|
109
|
+
|
|
110
|
+
com.src = " ";
|
|
111
|
+
com.fixDesc();
|
|
112
|
+
is(com.src, " ", "if no @desc tag is provided one is not added to just whitespace.");
|
|
113
|
+
|
|
114
|
+
com.src = "";
|
|
115
|
+
com.fixDesc();
|
|
116
|
+
is(com.src, "", "if no @desc tag is provided one is not added to empty.");
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
Remove slash-star comment wrapper from a raw comment string.
|
|
121
|
+
@type String
|
|
122
|
+
*/
|
|
123
|
+
JSDOC.DocComment.unwrapComment = function(/**String*/comment) {
|
|
124
|
+
if (!comment) return "";
|
|
125
|
+
var unwrapped = comment.replace(/(^\/\*\*|\*\/$)/g, "").replace(/^\s*\* ?/gm, "");
|
|
126
|
+
return unwrapped;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/*t:
|
|
130
|
+
plan(5, "testing JSDOC.DocComment.unwrapComment");
|
|
131
|
+
|
|
132
|
+
var com = "/**x*"+"/";
|
|
133
|
+
var unwrapped = JSDOC.DocComment.unwrapComment(com);
|
|
134
|
+
is(unwrapped, "x", "a single character jsdoc is found.");
|
|
135
|
+
|
|
136
|
+
com = "/***x*"+"/";
|
|
137
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
|
138
|
+
is(unwrapped, "x", "three stars are allowed in the opener.");
|
|
139
|
+
|
|
140
|
+
com = "/****x*"+"/";
|
|
141
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
|
142
|
+
is(unwrapped, "*x", "fourth star in the opener is kept.");
|
|
143
|
+
|
|
144
|
+
com = "/**x\n * y\n*"+"/";
|
|
145
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
|
146
|
+
is(unwrapped, "x\ny\n", "leading stars and spaces are trimmed.");
|
|
147
|
+
|
|
148
|
+
com = "/**x\n * y\n*"+"/";
|
|
149
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
|
150
|
+
is(unwrapped, "x\n y\n", "only first space after leading stars are trimmed.");
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
Provides a printable version of the comment.
|
|
155
|
+
@type String
|
|
156
|
+
*/
|
|
157
|
+
JSDOC.DocComment.prototype.toString = function() {
|
|
158
|
+
return this.src;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/*t:
|
|
162
|
+
plan(1, "testing JSDOC.DocComment#fixDesc");
|
|
163
|
+
var com = new JSDOC.DocComment();
|
|
164
|
+
com.src = "foo";
|
|
165
|
+
is(""+com, "foo", "stringifying a comment returns the unwrapped src.");
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
Given the title of a tag, returns all tags that have that title.
|
|
170
|
+
@type JSDOC.DocTag[]
|
|
171
|
+
*/
|
|
172
|
+
JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) {
|
|
173
|
+
return this.tags.filter(function($){return $.title == tagTitle});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
JSDOC.DocComment.prototype.deleteTag = function(/**String*/tagTitle) {
|
|
177
|
+
this.tags = this.tags.filter(function($){return $.title != tagTitle})
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/*t:
|
|
181
|
+
plan(1, "testing JSDOC.DocComment#getTag");
|
|
182
|
+
requires("../frame/String.js");
|
|
183
|
+
requires("../lib/JSDOC/DocTag.js");
|
|
184
|
+
|
|
185
|
+
var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/");
|
|
186
|
+
is(com.getTag("bar").length, 2, "getTag returns expected number of tags.");
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
Used to store the currently shared tag text.
|
|
191
|
+
*/
|
|
192
|
+
JSDOC.DocComment.shared = "";
|
|
193
|
+
|
|
194
|
+
/*t:
|
|
195
|
+
plan(2, "testing JSDOC.DocComment.shared");
|
|
196
|
+
requires("../frame/String.js");
|
|
197
|
+
requires("../lib/JSDOC/DocTag.js");
|
|
198
|
+
|
|
199
|
+
JSDOC.DocComment.shared = "@author Michael";
|
|
200
|
+
|
|
201
|
+
var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/");
|
|
202
|
+
is(com.getTag("author").length, 1, "getTag returns shared tag.");
|
|
203
|
+
is(com.getTag("foo").length, 2, "getTag returns unshared tags too.");
|
|
204
|
+
*/
|