sproutcore 0.9.13 → 0.9.14
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +19 -0
- data/Manifest.txt +103 -26
- data/app_generators/sproutcore/templates/README +1 -1
- data/bin/sc-build +1 -1
- data/bin/sc-gen +0 -0
- data/bin/sc-ide +278 -0
- data/bin/sc-init +38 -0
- data/bin/sc-install +96 -0
- data/bin/sc-remove +94 -0
- data/bin/sc-server +4 -0
- data/bin/sc-update +94 -0
- data/bin/sproutcore +3 -14
- data/clients/sc_docs/controllers/docs.js +1 -1
- data/clients/sc_docs/models/doc.js +6 -0
- data/clients/sc_docs/views/doc_frame.js +1 -1
- data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
- data/frameworks/sproutcore/HISTORY +34 -2
- data/frameworks/sproutcore/controllers/array.js +1 -1
- data/frameworks/sproutcore/controllers/controller.js +1 -1
- data/frameworks/sproutcore/controllers/object.js +9 -6
- data/frameworks/sproutcore/core.js +19 -4
- data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
- data/frameworks/sproutcore/english.lproj/core.css +1 -0
- data/frameworks/sproutcore/english.lproj/menu.css +1 -0
- data/frameworks/sproutcore/foundation/application.js +3 -3
- data/frameworks/sproutcore/foundation/benchmark.js +1 -1
- data/frameworks/sproutcore/foundation/node_descriptor.js +13 -1
- data/frameworks/sproutcore/foundation/page.js +3 -2
- data/frameworks/sproutcore/foundation/path_module.js +33 -16
- data/frameworks/sproutcore/foundation/run_loop.js +1 -1
- data/frameworks/sproutcore/foundation/server.js +68 -18
- data/frameworks/sproutcore/foundation/string.js +1 -1
- data/frameworks/sproutcore/globals/window.js +62 -15
- data/frameworks/sproutcore/lib/core_views.rb +1 -0
- data/frameworks/sproutcore/lib/index.rhtml +4 -3
- data/frameworks/sproutcore/lib/menu_views.rb +2 -2
- data/frameworks/sproutcore/models/collection.js +122 -107
- data/frameworks/sproutcore/models/record.js +2 -2
- data/frameworks/sproutcore/panes/manager.js +1 -1
- data/frameworks/sproutcore/panes/overlay.js +3 -3
- data/frameworks/sproutcore/tests/controllers/object.rhtml +26 -0
- data/frameworks/sproutcore/tests/views/collection/incremental_rendering.rhtml +2 -2
- data/frameworks/sproutcore/views/button/disclosure.js +1 -1
- data/frameworks/sproutcore/views/collection/collection.js +19 -15
- data/frameworks/sproutcore/views/collection/source_list.js +1 -1
- data/frameworks/sproutcore/views/collection/table.js +2 -2
- data/frameworks/sproutcore/views/error_explanation.js +1 -1
- data/frameworks/sproutcore/views/field/checkbox_field.js +1 -1
- data/frameworks/sproutcore/views/field/field.js +1 -1
- data/frameworks/sproutcore/views/field/radio_field.js +1 -1
- data/frameworks/sproutcore/views/field/select_field.js +1 -1
- data/frameworks/sproutcore/views/form.js +1 -1
- data/frameworks/sproutcore/views/image.js +1 -1
- data/frameworks/sproutcore/views/menu_item.js +1 -1
- data/frameworks/sproutcore/views/popup_button.js +1 -1
- data/frameworks/sproutcore/views/popup_menu.js +1 -1
- data/frameworks/sproutcore/views/progress.js +4 -2
- data/frameworks/sproutcore/views/radio_group.js +1 -1
- data/frameworks/sproutcore/views/scroll.js +1 -1
- data/frameworks/sproutcore/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/views/split.js +1 -1
- data/frameworks/sproutcore/views/tab.js +3 -1
- data/frameworks/sproutcore/views/view.js +19 -3
- data/jsdoc/README.txt +89 -57
- data/jsdoc/app/frame/Chain.js +102 -0
- data/jsdoc/app/frame/Dumper.js +144 -0
- data/jsdoc/app/frame/Hash.js +47 -0
- data/jsdoc/app/frame/Link.js +142 -0
- data/jsdoc/app/frame/Namespace.js +10 -0
- data/jsdoc/app/frame/Opt.js +134 -0
- data/jsdoc/app/frame/Reflection.js +26 -0
- data/jsdoc/app/frame/String.js +93 -0
- data/jsdoc/app/frame/Testrun.js +129 -0
- data/jsdoc/app/frame.js +33 -0
- data/jsdoc/app/handlers/FOODOC.js +26 -0
- data/jsdoc/app/handlers/XMLDOC/DomReader.js +159 -0
- data/jsdoc/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/jsdoc/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/jsdoc/app/handlers/XMLDOC.js +26 -0
- data/jsdoc/app/lib/JSDOC/DocComment.js +200 -0
- data/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
- data/jsdoc/app/lib/JSDOC/JsDoc.js +180 -0
- data/jsdoc/app/lib/JSDOC/JsPlate.js +100 -0
- data/jsdoc/app/lib/JSDOC/Lang.js +144 -0
- data/jsdoc/app/lib/JSDOC/Parser.js +109 -0
- data/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
- data/jsdoc/app/lib/JSDOC/Symbol.js +600 -0
- data/jsdoc/app/lib/JSDOC/SymbolSet.js +220 -0
- data/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
- data/jsdoc/app/lib/JSDOC/Token.js +18 -0
- data/jsdoc/app/lib/JSDOC/TokenReader.js +323 -0
- data/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
- data/jsdoc/app/lib/JSDOC/Util.js +32 -0
- data/jsdoc/app/lib/JSDOC/Walker.js +416 -0
- data/jsdoc/app/lib/JSDOC.js +97 -0
- data/jsdoc/app/main.js +74 -0
- data/jsdoc/app/plugins/commentSrcJson.js +19 -0
- data/jsdoc/app/plugins/frameworkPrototype.js +16 -0
- data/jsdoc/app/plugins/functionCall.js +10 -0
- data/jsdoc/app/plugins/publishSrcHilite.js +62 -0
- data/jsdoc/app/plugins/sproutcoreTags.js +26 -0
- data/jsdoc/app/plugins/symbolLink.js +9 -0
- data/jsdoc/app/plugins/tagParamConfig.js +31 -0
- data/jsdoc/app/plugins/tagSynonyms.js +43 -0
- data/jsdoc/app/run.js +339 -137
- data/jsdoc/changes.txt +47 -0
- data/jsdoc/conf/sample.conf +31 -0
- data/jsdoc/java/build.xml +36 -0
- data/jsdoc/java/build_1.4.xml +36 -0
- data/jsdoc/java/classes/js.jar +0 -0
- data/jsdoc/java/src/JsDebugRun.java +21 -0
- data/jsdoc/java/src/JsRun.java +21 -0
- data/jsdoc/jsdebug.jar +0 -0
- data/jsdoc/jsrun.jar +0 -0
- data/jsdoc/t/TestDoc.js +144 -0
- data/jsdoc/t/runner.js +13 -0
- data/jsdoc/templates/sproutcore/allclasses.tmpl +17 -0
- data/jsdoc/templates/sproutcore/allfiles.tmpl +56 -0
- data/jsdoc/templates/sproutcore/class.tmpl +408 -326
- data/jsdoc/templates/sproutcore/index.tmpl +30 -31
- data/jsdoc/templates/sproutcore/publish.js +173 -81
- data/jsdoc/templates/sproutcore/static/default.css +191 -0
- data/jsdoc/templates/sproutcore/static/header.html +2 -0
- data/jsdoc/templates/sproutcore/static/index.html +19 -0
- data/jsdoc/templates/sproutcore/symbol.tmpl +35 -0
- data/jsdoc/test/addon.js +24 -0
- data/jsdoc/test/anon_inner.js +14 -0
- data/jsdoc/test/augments.js +31 -0
- data/jsdoc/test/augments2.js +26 -0
- data/jsdoc/test/borrows.js +41 -0
- data/jsdoc/test/borrows2.js +23 -0
- data/jsdoc/test/config.js +22 -0
- data/jsdoc/test/constructs.js +18 -0
- data/jsdoc/test/encoding.js +10 -0
- data/jsdoc/test/encoding_other.js +12 -0
- data/jsdoc/test/functions_anon.js +39 -0
- data/jsdoc/test/functions_nested.js +33 -0
- data/jsdoc/test/global.js +13 -0
- data/jsdoc/test/globals.js +25 -0
- data/jsdoc/test/ignore.js +10 -0
- data/jsdoc/test/inner.js +16 -0
- data/jsdoc/test/jsdoc_test.js +477 -0
- data/jsdoc/test/lend.js +33 -0
- data/jsdoc/test/memberof.js +20 -0
- data/jsdoc/test/memberof_constructor.js +15 -0
- data/jsdoc/test/name.js +19 -0
- data/jsdoc/test/namespace_nested.js +23 -0
- data/jsdoc/test/nocode.js +13 -0
- data/jsdoc/test/oblit_anon.js +20 -0
- data/jsdoc/test/overview.js +20 -0
- data/jsdoc/test/param_inline.js +37 -0
- data/jsdoc/test/params_optional.js +8 -0
- data/jsdoc/test/prototype.js +17 -0
- data/jsdoc/test/prototype_nested.js +9 -0
- data/jsdoc/test/prototype_oblit.js +13 -0
- data/jsdoc/test/prototype_oblit_constructor.js +24 -0
- data/jsdoc/test/public.js +10 -0
- data/jsdoc/test/shared.js +42 -0
- data/jsdoc/test/shared2.js +2 -0
- data/jsdoc/test/shortcuts.js +22 -0
- data/jsdoc/test/static_this.js +13 -0
- data/jsdoc/test/synonyms.js +23 -0
- data/jsdoc/test/tosource.js +23 -0
- data/jsdoc/test/variable_redefine.js +14 -0
- data/jsdoc/test.js +304 -0
- data/lib/sproutcore/build_tools/resource_builder.rb +6 -1
- data/lib/sproutcore/bundle_installer.rb +268 -0
- data/lib/sproutcore/jsdoc.rb +7 -6
- data/lib/sproutcore/library.rb +38 -0
- data/lib/sproutcore/merb/bundle_controller.rb +8 -4
- data/lib/sproutcore/version.rb +1 -1
- data/lib/sproutcore.rb +1 -1
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/txt2html +0 -0
- metadata +117 -29
- data/clients/view_builder/core.js +0 -19
- data/clients/view_builder/english.lproj/body.css +0 -149
- data/clients/view_builder/english.lproj/body.rhtml +0 -18
- data/clients/view_builder/english.lproj/strings.js +0 -14
- data/clients/view_builder/main.js +0 -37
- data/jsdoc/app/DocFile.js +0 -137
- data/jsdoc/app/DocTag.js +0 -110
- data/jsdoc/app/Doclet.js +0 -63
- data/jsdoc/app/Dumper.js +0 -143
- data/jsdoc/app/JsDoc.js +0 -103
- data/jsdoc/app/JsHilite.js +0 -45
- data/jsdoc/app/JsIO.js +0 -163
- data/jsdoc/app/JsParse.js +0 -385
- data/jsdoc/app/JsPlate.js +0 -130
- data/jsdoc/app/JsTestrun.js +0 -129
- data/jsdoc/app/JsToke.js +0 -564
- data/jsdoc/app/Symbol.js +0 -298
- data/jsdoc/app/Transformer.js +0 -14
- data/jsdoc/app/Util.js +0 -97
- data/jsdoc/app/js.jar +0 -0
- data/jsdoc/plugins/min.js +0 -316
- data/jsdoc/plugins/strip.js +0 -20
- data/jsdoc/templates/sproutcore/default.css +0 -191
- data/jsdoc/templates/sproutcore/index.html +0 -13
- data/jsdoc/templates/sproutcore/prototype.js +0 -4186
- data/jsdoc/templates/sproutcore/splash.html +0 -7
@@ -0,0 +1,100 @@
|
|
1
|
+
/**
|
2
|
+
@constructor
|
3
|
+
*/
|
4
|
+
JSDOC.JsPlate = function(templateFile) {
|
5
|
+
if (templateFile) this.template = IO.readFile(templateFile);
|
6
|
+
|
7
|
+
this.templateFile = templateFile;
|
8
|
+
this.code = "";
|
9
|
+
this.parse();
|
10
|
+
}
|
11
|
+
|
12
|
+
JSDOC.JsPlate.prototype.parse = function() {
|
13
|
+
this.template = this.template.replace(/\{#[\s\S]+?#\}/gi, "");
|
14
|
+
this.code = "var output=``"+this.template;
|
15
|
+
|
16
|
+
this.code = this.code.replace(
|
17
|
+
/<for +each="(.+?)" +in="(.+?)" *>/gi,
|
18
|
+
function (match, eachName, inName) {
|
19
|
+
return "``;\rvar $"+eachName+"_keys = keys("+inName+");\rfor(var $"+eachName+"_i = 0; $"+eachName+"_i < $"+eachName+"_keys.length; $"+eachName+"_i++) {\rvar $"+eachName+"_last = ($"+eachName+"_i == $"+eachName+"_keys.length-1);\rvar $"+eachName+"_key = $"+eachName+"_keys[$"+eachName+"_i];\rvar "+eachName+" = "+inName+"[$"+eachName+"_key];\routput+=``";
|
20
|
+
}
|
21
|
+
);
|
22
|
+
this.code = this.code.replace(/<if test="(.+?)">/g, "``;\rif ($1) { output+=``");
|
23
|
+
this.code = this.code.replace(/<elseif test="(.+?)"\s*\/>/g, "``;}\relse if ($1) { output+=``");
|
24
|
+
this.code = this.code.replace(/<else\s*\/>/g, "``;}\relse { output+=``");
|
25
|
+
this.code = this.code.replace(/<\/(if|for)>/g, "``;\r};\routput+=``");
|
26
|
+
this.code = this.code.replace(
|
27
|
+
/\{\+\s*([\s\S]+?)\s*\+\}/gi,
|
28
|
+
function (match, code) {
|
29
|
+
code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
|
30
|
+
code = code.replace(/(\r?\n)/g, " ");
|
31
|
+
return "``+ ("+code+") +``";
|
32
|
+
}
|
33
|
+
);
|
34
|
+
this.code = this.code.replace(
|
35
|
+
/\{!\s*([\s\S]+?)\s*!\}/gi,
|
36
|
+
function (match, code) {
|
37
|
+
code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
|
38
|
+
code = code.replace(/(\n)/g, " ");
|
39
|
+
return "``; "+code+";\routput+=``";
|
40
|
+
}
|
41
|
+
);
|
42
|
+
this.code = this.code+"``;";
|
43
|
+
|
44
|
+
this.code = this.code.replace(/(\r?\n)/g, "\\n");
|
45
|
+
this.code = this.code.replace(/"/g, "\\\"");
|
46
|
+
this.code = this.code.replace(/``/g, "\"");
|
47
|
+
}
|
48
|
+
|
49
|
+
JSDOC.JsPlate.prototype.toCode = function() {
|
50
|
+
return this.code;
|
51
|
+
}
|
52
|
+
|
53
|
+
JSDOC.JsPlate.keys = function(obj) {
|
54
|
+
var keys = [];
|
55
|
+
if (obj.constructor.toString().indexOf("Array") > -1) {
|
56
|
+
for (var i = 0; i < obj.length; i++) {
|
57
|
+
keys.push(i);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
for (var i in obj) {
|
62
|
+
keys.push(i);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return keys;
|
66
|
+
};
|
67
|
+
|
68
|
+
JSDOC.JsPlate.values = function(obj) {
|
69
|
+
var values = [];
|
70
|
+
if (obj.constructor.toString().indexOf("Array") > -1) {
|
71
|
+
for (var i = 0; i < obj.length; i++) {
|
72
|
+
values.push(obj[i]);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
for (var i in obj) {
|
77
|
+
values.push(obj[i]);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
return values;
|
81
|
+
};
|
82
|
+
|
83
|
+
JSDOC.JsPlate.prototype.process = function(data) {
|
84
|
+
var keys = JSDOC.JsPlate.keys;
|
85
|
+
var values = JSDOC.JsPlate.values;
|
86
|
+
|
87
|
+
try {
|
88
|
+
eval(this.code);
|
89
|
+
}
|
90
|
+
catch (e) {
|
91
|
+
print(">> There was an error evaluating the compiled code from template: "+this.templateFile);
|
92
|
+
print(" The error was on line "+e.lineNumber+" "+e.name+": "+e.message);
|
93
|
+
var lines = this.code.split("\r");
|
94
|
+
if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]);
|
95
|
+
print("line "+e.lineNumber+": "+lines[e.lineNumber-1]);
|
96
|
+
print("");
|
97
|
+
}
|
98
|
+
/*debug*///print(this.code);
|
99
|
+
return output;
|
100
|
+
}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/**
|
2
|
+
@namespace
|
3
|
+
*/
|
4
|
+
JSDOC.Lang = {
|
5
|
+
}
|
6
|
+
|
7
|
+
JSDOC.Lang.isBuiltin = function(name) {
|
8
|
+
return (JSDOC.Lang.isBuiltin.coreObjects.indexOf(name) > -1);
|
9
|
+
}
|
10
|
+
JSDOC.Lang.isBuiltin.coreObjects = ['_global_', 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String'];
|
11
|
+
|
12
|
+
JSDOC.Lang.whitespace = function(ch) {
|
13
|
+
return JSDOC.Lang.whitespace.names[ch];
|
14
|
+
}
|
15
|
+
JSDOC.Lang.whitespace.names = {
|
16
|
+
" ": "SPACE",
|
17
|
+
"\f": "FORMFEED",
|
18
|
+
"\t": "TAB",
|
19
|
+
"\u0009": "UNICODE_TAB",
|
20
|
+
"\u000A": "UNICODE_NBR",
|
21
|
+
"\u0008": "VERTICAL_TAB"
|
22
|
+
};
|
23
|
+
|
24
|
+
JSDOC.Lang.newline = function(ch) {
|
25
|
+
return JSDOC.Lang.newline.names[ch];
|
26
|
+
}
|
27
|
+
JSDOC.Lang.newline.names = {
|
28
|
+
"\n": "NEWLINE",
|
29
|
+
"\r": "RETURN",
|
30
|
+
"\u000A": "UNICODE_LF",
|
31
|
+
"\u000D": "UNICODE_CR",
|
32
|
+
"\u2029": "UNICODE_PS",
|
33
|
+
"\u2028": "UNICODE_LS"
|
34
|
+
};
|
35
|
+
|
36
|
+
JSDOC.Lang.keyword = function(word) {
|
37
|
+
return JSDOC.Lang.keyword.names["="+word];
|
38
|
+
}
|
39
|
+
JSDOC.Lang.keyword.names = {
|
40
|
+
"=break": "BREAK",
|
41
|
+
"=case": "CASE",
|
42
|
+
"=catch": "CATCH",
|
43
|
+
"=const": "VAR",
|
44
|
+
"=continue": "CONTINUE",
|
45
|
+
"=default": "DEFAULT",
|
46
|
+
"=delete": "DELETE",
|
47
|
+
"=do": "DO",
|
48
|
+
"=else": "ELSE",
|
49
|
+
"=false": "FALSE",
|
50
|
+
"=finally": "FINALLY",
|
51
|
+
"=for": "FOR",
|
52
|
+
"=function": "FUNCTION",
|
53
|
+
"=if": "IF",
|
54
|
+
"=in": "IN",
|
55
|
+
"=instanceof": "INSTANCEOF",
|
56
|
+
"=new": "NEW",
|
57
|
+
"=null": "NULL",
|
58
|
+
"=return": "RETURN",
|
59
|
+
"=switch": "SWITCH",
|
60
|
+
"=this": "THIS",
|
61
|
+
"=throw": "THROW",
|
62
|
+
"=true": "TRUE",
|
63
|
+
"=try": "TRY",
|
64
|
+
"=typeof": "TYPEOF",
|
65
|
+
"=void": "VOID",
|
66
|
+
"=while": "WHILE",
|
67
|
+
"=with": "WITH",
|
68
|
+
"=var": "VAR"
|
69
|
+
};
|
70
|
+
|
71
|
+
JSDOC.Lang.punc = function(ch) {
|
72
|
+
return JSDOC.Lang.punc.names[ch];
|
73
|
+
}
|
74
|
+
JSDOC.Lang.punc.names = {
|
75
|
+
";": "SEMICOLON",
|
76
|
+
",": "COMMA",
|
77
|
+
"?": "HOOK",
|
78
|
+
":": "COLON",
|
79
|
+
"||": "OR",
|
80
|
+
"&&": "AND",
|
81
|
+
"|": "BITWISE_OR",
|
82
|
+
"^": "BITWISE_XOR",
|
83
|
+
"&": "BITWISE_AND",
|
84
|
+
"===": "STRICT_EQ",
|
85
|
+
"==": "EQ",
|
86
|
+
"=": "ASSIGN",
|
87
|
+
"!==": "STRICT_NE",
|
88
|
+
"!=": "NE",
|
89
|
+
"<<": "LSH",
|
90
|
+
"<=": "LE",
|
91
|
+
"<": "LT",
|
92
|
+
">>>": "URSH",
|
93
|
+
">>": "RSH",
|
94
|
+
">=": "GE",
|
95
|
+
">": "GT",
|
96
|
+
"++": "INCREMENT",
|
97
|
+
"--": "DECREMENT",
|
98
|
+
"+": "PLUS",
|
99
|
+
"-": "MINUS",
|
100
|
+
"*": "MUL",
|
101
|
+
"/": "DIV",
|
102
|
+
"%": "MOD",
|
103
|
+
"!": "NOT",
|
104
|
+
"~": "BITWISE_NOT",
|
105
|
+
".": "DOT",
|
106
|
+
"[": "LEFT_BRACKET",
|
107
|
+
"]": "RIGHT_BRACKET",
|
108
|
+
"{": "LEFT_CURLY",
|
109
|
+
"}": "RIGHT_CURLY",
|
110
|
+
"(": "LEFT_PAREN",
|
111
|
+
")": "RIGHT_PAREN"
|
112
|
+
};
|
113
|
+
|
114
|
+
JSDOC.Lang.matching = function(name) {
|
115
|
+
return JSDOC.Lang.matching.names[name];
|
116
|
+
}
|
117
|
+
JSDOC.Lang.matching.names = {
|
118
|
+
"LEFT_PAREN": "RIGHT_PAREN",
|
119
|
+
"RIGHT_PAREN": "LEFT_PAREN",
|
120
|
+
"LEFT_CURLY": "RIGHT_CURLY",
|
121
|
+
"RIGHT_CURLY": "LEFT_CURLY",
|
122
|
+
"LEFT_BRACE": "RIGHT_BRACE",
|
123
|
+
"RIGHT_BRACE": "LEFT_BRACE"
|
124
|
+
}
|
125
|
+
|
126
|
+
JSDOC.Lang.isNumber = function(str) {
|
127
|
+
return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str);
|
128
|
+
}
|
129
|
+
|
130
|
+
JSDOC.Lang.isHexDec = function(str) {
|
131
|
+
return /^0x[0-9A-F]+$/i.test(str);
|
132
|
+
}
|
133
|
+
|
134
|
+
JSDOC.Lang.isWordChar = function(str) {
|
135
|
+
return /^[a-zA-Z0-9$_.]+$/.test(str);
|
136
|
+
}
|
137
|
+
|
138
|
+
JSDOC.Lang.isSpace = function(str) {
|
139
|
+
return (typeof JSDOC.Lang.whitespace(str) != "undefined");
|
140
|
+
}
|
141
|
+
|
142
|
+
JSDOC.Lang.isNewline = function(str) {
|
143
|
+
return (typeof JSDOC.Lang.newline(str) != "undefined");
|
144
|
+
}
|
@@ -0,0 +1,109 @@
|
|
1
|
+
if (typeof JSDOC == "undefined") JSDOC = {};
|
2
|
+
|
3
|
+
/**
|
4
|
+
@namespace
|
5
|
+
@requires JSDOC.Walker
|
6
|
+
@requires JSDOC.Symbol
|
7
|
+
@requires JSDOC.DocComment
|
8
|
+
*/
|
9
|
+
JSDOC.Parser = {
|
10
|
+
conf: {
|
11
|
+
ignoreCode: JSDOC.opt.n,
|
12
|
+
ignoreAnonymous: true, // factory: true
|
13
|
+
treatUnderscoredAsPrivate: true, // factory: true
|
14
|
+
explain: false // factory: false
|
15
|
+
},
|
16
|
+
|
17
|
+
addSymbol: function(symbol) {
|
18
|
+
// if a symbol alias is documented more than once the last one with the user docs wins
|
19
|
+
if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) {
|
20
|
+
var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias);
|
21
|
+
|
22
|
+
if (oldSymbol.comment.isUserComment) {
|
23
|
+
if (symbol.comment.isUserComment) { // old and new are both documented
|
24
|
+
LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
|
25
|
+
}
|
26
|
+
else { // old is documented but new isn't
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
// we don't document anonymous things
|
33
|
+
if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
|
34
|
+
|
35
|
+
// uderscored things may be treated as if they were marked private, this cascades
|
36
|
+
if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
|
37
|
+
symbol.isPrivate = true;
|
38
|
+
}
|
39
|
+
|
40
|
+
// -p flag is required to document private things
|
41
|
+
if ((symbol.isInner || symbol.isPrivate) && !JSDOC.opt.p) return;
|
42
|
+
|
43
|
+
// ignored things are not documented, this doesn't cascade
|
44
|
+
if (symbol.isIgnored) return;
|
45
|
+
|
46
|
+
JSDOC.Parser.symbols.addSymbol(symbol);
|
47
|
+
},
|
48
|
+
|
49
|
+
addBuiltin: function(name) {
|
50
|
+
var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment(""));
|
51
|
+
builtin.isNamespace = true;
|
52
|
+
builtin.srcFile = "";
|
53
|
+
builtin.isPrivate = false;
|
54
|
+
JSDOC.Parser.addSymbol(builtin);
|
55
|
+
return builtin;
|
56
|
+
},
|
57
|
+
|
58
|
+
init: function() {
|
59
|
+
JSDOC.Parser.symbols = new JSDOC.SymbolSet();
|
60
|
+
JSDOC.Parser.walker = new JSDOC.Walker();
|
61
|
+
},
|
62
|
+
|
63
|
+
finish: function() {
|
64
|
+
JSDOC.Parser.symbols.relate();
|
65
|
+
|
66
|
+
// make a litle report about what was found
|
67
|
+
if (JSDOC.Parser.conf.explain) {
|
68
|
+
var symbols = JSDOC.Parser.symbols.toArray();
|
69
|
+
var srcFile = "";
|
70
|
+
for (var i = 0, l = symbols.length; i < l; i++) {
|
71
|
+
var symbol = symbols[i];
|
72
|
+
if (srcFile != symbol.srcFile) {
|
73
|
+
srcFile = symbol.srcFile;
|
74
|
+
print("\n"+srcFile+"\n-------------------");
|
75
|
+
}
|
76
|
+
print(i+":\n alias => "+symbol.alias + "\n name => "+symbol.name+ "\n isa => "+symbol.isa + "\n memberOf => " + symbol.memberOf + "\n isStatic => " + symbol.isStatic + ", isInner => " + symbol.isInner);
|
77
|
+
}
|
78
|
+
print("-------------------\n");
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) {
|
84
|
+
JSDOC.Symbol.srcFile = (srcFile || "");
|
85
|
+
JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries
|
86
|
+
|
87
|
+
if (!JSDOC.Parser.walker) JSDOC.Parser.init();
|
88
|
+
JSDOC.Parser.walker.walk(ts); // adds to our symbols
|
89
|
+
|
90
|
+
// filter symbols by option
|
91
|
+
for (p in JSDOC.Parser.symbols._index) {
|
92
|
+
var symbol = JSDOC.Parser.symbols.getSymbol(p);
|
93
|
+
|
94
|
+
if (!symbol) continue;
|
95
|
+
|
96
|
+
if (symbol.is("FILE") || symbol.is("GLOBAL")) {
|
97
|
+
continue;
|
98
|
+
}
|
99
|
+
else if (!JSDOC.opt.a && !symbol.comment.isUserComment) {
|
100
|
+
JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
|
101
|
+
}
|
102
|
+
|
103
|
+
if (/#$/.test(symbol.alias)) { // we don't document prototypes
|
104
|
+
JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
return JSDOC.Parser.symbols.toArray();
|
109
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
@namespace Holds functionality related to running plugins.
|
3
|
+
*/
|
4
|
+
JSDOC.PluginManager = {
|
5
|
+
}
|
6
|
+
|
7
|
+
/**
|
8
|
+
@param name A unique name that identifies that plugin.
|
9
|
+
@param handlers A collection of named functions. The names correspond to hooks in the core code.
|
10
|
+
*/
|
11
|
+
JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) {
|
12
|
+
if (!defined(JSDOC.PluginManager.plugins))
|
13
|
+
/** The collection of all plugins. Requires a unique name for each.
|
14
|
+
*/
|
15
|
+
JSDOC.PluginManager.plugins = {};
|
16
|
+
|
17
|
+
|
18
|
+
JSDOC.PluginManager.plugins[name] = handlers;
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
@param hook The name of the hook that is being caught.
|
23
|
+
@param target Any object. This will be passed as the only argument to the handler whose
|
24
|
+
name matches the hook name. Handlers cannot return a value, so must modify the target
|
25
|
+
object to have an effect.
|
26
|
+
*/
|
27
|
+
JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) {
|
28
|
+
for (var name in JSDOC.PluginManager.plugins) {
|
29
|
+
if (defined(JSDOC.PluginManager.plugins[name][hook])) {
|
30
|
+
JSDOC.PluginManager.plugins[name][hook](target);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|