ragaskar-jsdoc_helper 0.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/README.rdoc +64 -0
  2. data/bin/jsdoc_helper +8 -0
  3. data/ext/jsdoc-toolkit/README.txt +146 -0
  4. data/ext/jsdoc-toolkit/app/frame.js +33 -0
  5. data/ext/jsdoc-toolkit/app/frame/Chain.js +102 -0
  6. data/ext/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  7. data/ext/jsdoc-toolkit/app/frame/Hash.js +84 -0
  8. data/ext/jsdoc-toolkit/app/frame/Link.js +148 -0
  9. data/ext/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  10. data/ext/jsdoc-toolkit/app/frame/Opt.js +134 -0
  11. data/ext/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  12. data/ext/jsdoc-toolkit/app/frame/String.js +93 -0
  13. data/ext/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  14. data/ext/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  15. data/ext/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  16. data/ext/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  17. data/ext/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  18. data/ext/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  19. data/ext/jsdoc-toolkit/app/lib/JSDOC.js +101 -0
  20. data/ext/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
  21. data/ext/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
  22. data/ext/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
  23. data/ext/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  24. data/ext/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  25. data/ext/jsdoc-toolkit/app/lib/JSDOC/Parser.js +107 -0
  26. data/ext/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  27. data/ext/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +643 -0
  28. data/ext/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +229 -0
  29. data/ext/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  30. data/ext/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  31. data/ext/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  32. data/ext/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  33. data/ext/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  34. data/ext/jsdoc-toolkit/app/lib/JSDOC/Walker.js +459 -0
  35. data/ext/jsdoc-toolkit/app/main.js +111 -0
  36. data/ext/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  37. data/ext/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  38. data/ext/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  39. data/ext/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
  40. data/ext/jsdoc-toolkit/app/plugins/symbolLink.js +9 -0
  41. data/ext/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  42. data/ext/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  43. data/ext/jsdoc-toolkit/app/run.js +348 -0
  44. data/ext/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  45. data/ext/jsdoc-toolkit/app/t/runner.js +13 -0
  46. data/ext/jsdoc-toolkit/app/test.js +307 -0
  47. data/ext/jsdoc-toolkit/app/test/addon.js +24 -0
  48. data/ext/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  49. data/ext/jsdoc-toolkit/app/test/augments.js +31 -0
  50. data/ext/jsdoc-toolkit/app/test/augments2.js +26 -0
  51. data/ext/jsdoc-toolkit/app/test/borrows.js +41 -0
  52. data/ext/jsdoc-toolkit/app/test/borrows2.js +23 -0
  53. data/ext/jsdoc-toolkit/app/test/config.js +22 -0
  54. data/ext/jsdoc-toolkit/app/test/constructs.js +18 -0
  55. data/ext/jsdoc-toolkit/app/test/encoding.js +10 -0
  56. data/ext/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  57. data/ext/jsdoc-toolkit/app/test/event.js +54 -0
  58. data/ext/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  59. data/ext/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  60. data/ext/jsdoc-toolkit/app/test/global.js +13 -0
  61. data/ext/jsdoc-toolkit/app/test/globals.js +25 -0
  62. data/ext/jsdoc-toolkit/app/test/ignore.js +10 -0
  63. data/ext/jsdoc-toolkit/app/test/inner.js +16 -0
  64. data/ext/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  65. data/ext/jsdoc-toolkit/app/test/lend.js +33 -0
  66. data/ext/jsdoc-toolkit/app/test/memberof.js +19 -0
  67. data/ext/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  68. data/ext/jsdoc-toolkit/app/test/name.js +19 -0
  69. data/ext/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  70. data/ext/jsdoc-toolkit/app/test/nocode.js +13 -0
  71. data/ext/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  72. data/ext/jsdoc-toolkit/app/test/overview.js +20 -0
  73. data/ext/jsdoc-toolkit/app/test/param_inline.js +37 -0
  74. data/ext/jsdoc-toolkit/app/test/params_optional.js +8 -0
  75. data/ext/jsdoc-toolkit/app/test/prototype.js +17 -0
  76. data/ext/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  77. data/ext/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  78. data/ext/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  79. data/ext/jsdoc-toolkit/app/test/public.js +10 -0
  80. data/ext/jsdoc-toolkit/app/test/shared.js +42 -0
  81. data/ext/jsdoc-toolkit/app/test/shared2.js +2 -0
  82. data/ext/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  83. data/ext/jsdoc-toolkit/app/test/static_this.js +13 -0
  84. data/ext/jsdoc-toolkit/app/test/synonyms.js +31 -0
  85. data/ext/jsdoc-toolkit/app/test/tosource.js +23 -0
  86. data/ext/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  87. data/ext/jsdoc-toolkit/changes.txt +75 -0
  88. data/ext/jsdoc-toolkit/conf/sample.conf +31 -0
  89. data/ext/jsdoc-toolkit/java/build.xml +36 -0
  90. data/ext/jsdoc-toolkit/java/build_1.4.xml +36 -0
  91. data/ext/jsdoc-toolkit/java/classes/js.jar +0 -0
  92. data/ext/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  93. data/ext/jsdoc-toolkit/java/src/JsRun.java +21 -0
  94. data/ext/jsdoc-toolkit/jsdebug.jar +0 -0
  95. data/ext/jsdoc-toolkit/jsrun.jar +0 -0
  96. data/ext/jsdoc-toolkit/out/jsdoc/files.html +216 -0
  97. data/ext/jsdoc-toolkit/out/jsdoc/index.html +210 -0
  98. data/ext/jsdoc-toolkit/out/jsdoc/symbols/_global_.html +306 -0
  99. data/ext/jsdoc-toolkit/out/jsdoc/symbols/src/lib_test.js.html +13 -0
  100. data/ext/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  101. data/ext/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  102. data/ext/jsdoc-toolkit/templates/jsdoc/class.tmpl +646 -0
  103. data/ext/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  104. data/ext/jsdoc-toolkit/templates/jsdoc/publish.js +184 -0
  105. data/ext/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  106. data/ext/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  107. data/ext/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  108. data/ext/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  109. data/lib/jsdoc_helper.rb +50 -0
  110. data/lib/jsdoc_helper/rake/task.rb +43 -0
  111. data/lib/jsdoc_helper/rake/task/runner.rb +85 -0
  112. data/spec/jsdoc_helper/jsdoc_helper_spec.rb +4 -0
  113. data/spec/jsdoc_helper/rake/task/runner_spec.rb +45 -0
  114. data/spec/jsdoc_helper/support/file_helper_spec.rb +93 -0
  115. data/spec/spec_helper.rb +25 -0
  116. metadata +168 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ @constructor
3
+ @param [opt] Used to override the commandline options. Useful for testing.
4
+ @version $Id: JsDoc.js 769 2009-01-11 12:13:00Z micmath $
5
+ */
6
+ JSDOC.JsDoc = function(/**object*/ opt) {
7
+ if (opt) {
8
+ JSDOC.opt = opt;
9
+ }
10
+
11
+ if (JSDOC.opt.h) {
12
+ JSDOC.usage();
13
+ quit();
14
+ }
15
+
16
+ // defend against options that are not sane
17
+ if (JSDOC.opt._.length == 0) {
18
+ LOG.warn("No source files to work on. Nothing to do.");
19
+ quit();
20
+ }
21
+ if (JSDOC.opt.t === true || JSDOC.opt.d === true) {
22
+ JSDOC.usage();
23
+ }
24
+
25
+ if (typeof JSDOC.opt.d == "string") {
26
+ if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) {
27
+ JSDOC.opt.d = JSDOC.opt.d+"/";
28
+ }
29
+ LOG.inform("Output directory set to '"+JSDOC.opt.d+"'.");
30
+ IO.mkPath(JSDOC.opt.d);
31
+ }
32
+ if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e);
33
+
34
+ // the -r option: scan source directories recursively
35
+ if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10;
36
+ else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r);
37
+ else JSDOC.opt.r = 1;
38
+
39
+ // the -D option: define user variables
40
+ var D = {};
41
+ if (JSDOC.opt.D) {
42
+ for (var i = 0; i < JSDOC.opt.D.length; i++) {
43
+ var defineParts = JSDOC.opt.D[i].split(":", 2);
44
+ if (defineParts) D[defineParts[0]] = defineParts[1];
45
+ }
46
+ }
47
+ JSDOC.opt.D = D;
48
+ // combine any conf file D options with the commandline D options
49
+ if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) {
50
+ if (!defined(JSDOC.opt.D[c])) {
51
+ JSDOC.opt.D[c] = JSDOC.conf.D[c];
52
+ }
53
+ }
54
+
55
+ // Give plugins a chance to initialize
56
+ if (defined(JSDOC.PluginManager)) {
57
+ JSDOC.PluginManager.run("onInit", JSDOC.opt);
58
+ }
59
+
60
+ JSDOC.opt.srcFiles = JSDOC.JsDoc._getSrcFiles();
61
+ JSDOC.JsDoc._parseSrcFiles();
62
+ JSDOC.JsDoc.symbolSet = JSDOC.Parser.symbols;
63
+ }
64
+
65
+ /**
66
+ Retrieve source file list.
67
+ @returns {String[]} The pathnames of the files to be parsed.
68
+ */
69
+ JSDOC.JsDoc._getSrcFiles = function() {
70
+ JSDOC.JsDoc.srcFiles = [];
71
+
72
+ var ext = ["js"];
73
+ if (JSDOC.opt.x) {
74
+ ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()});
75
+ }
76
+
77
+ for (var i = 0; i < JSDOC.opt._.length; i++) {
78
+ JSDOC.JsDoc.srcFiles = JSDOC.JsDoc.srcFiles.concat(
79
+ IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter(
80
+ function($) {
81
+ var thisExt = $.split(".").pop().toLowerCase();
82
+
83
+ if (JSDOC.opt.E) {
84
+ for(var n = 0; n < JSDOC.opt.E.length; n++) {
85
+ if ($.match(new RegExp(JSDOC.opt.E[n]))) {
86
+ LOG.inform("Excluding " + $);
87
+ return false; // if the file matches the regex then it's excluded.
88
+ }
89
+ }
90
+ }
91
+
92
+ return (ext.indexOf(thisExt) > -1 || thisExt in JSDOC.handlers); // we're only interested in files with certain extensions
93
+ }
94
+ )
95
+ );
96
+ }
97
+
98
+ return JSDOC.JsDoc.srcFiles;
99
+ }
100
+
101
+ JSDOC.JsDoc._parseSrcFiles = function() {
102
+ JSDOC.Parser.init();
103
+ for (var i = 0, l = JSDOC.JsDoc.srcFiles.length; i < l; i++) {
104
+ var srcFile = JSDOC.JsDoc.srcFiles[i];
105
+
106
+ if (JSDOC.opt.v) LOG.inform("Parsing file: " + srcFile);
107
+
108
+ try {
109
+ var src = IO.readFile(srcFile);
110
+ }
111
+ catch(e) {
112
+ LOG.warn("Can't read source file '"+srcFile+"': "+e.message);
113
+ }
114
+
115
+ var tr = new JSDOC.TokenReader();
116
+ var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src)));
117
+
118
+ JSDOC.Parser.parse(ts, srcFile);
119
+
120
+ }
121
+ JSDOC.Parser.finish();
122
+
123
+ if (JSDOC.PluginManager) {
124
+ JSDOC.PluginManager.run("onFinishedParsing", JSDOC.Parser.symbols);
125
+ }
126
+ }
@@ -0,0 +1,109 @@
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, compact) {
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
+
99
+ if (compact) { // patch by mcbain.asm
100
+ // Remove lines that contain only space-characters, usually left by lines in the template
101
+ // which originally only contained JSPlate tags or code. This makes it easier to write
102
+ // non-tricky templates which still put out nice code (not bloated with extra lines).
103
+ // Lines purposely left blank (just a line ending) are left alone.
104
+ output = output.replace(/\s+?(\r?)\n/g, "$1\n");
105
+ }
106
+
107
+ /*debug*///print(this.code);
108
+ return output;
109
+ }
@@ -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', 'Error', '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,107 @@
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
+ if (oldSymbol.comment.isUserComment) {
22
+ if (symbol.comment.isUserComment) { // old and new are both documented
23
+ LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
24
+ }
25
+ else { // old is documented but new isn't
26
+ return;
27
+ }
28
+ }
29
+ }
30
+
31
+ // we don't document anonymous things
32
+ if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
33
+
34
+ // uderscored things may be treated as if they were marked private, this cascades
35
+ if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
36
+ if (!symbol.comment.getTag("public").length > 0) symbol.isPrivate = true;
37
+ }
38
+
39
+ // -p flag is required to document private things
40
+ if (!JSDOC.opt.p && symbol.isPrivate) return; // issue #161 fixed by mcbain.asm
41
+
42
+ // ignored things are not documented, this doesn't cascade
43
+ if (symbol.isIgnored) return;
44
+ JSDOC.Parser.symbols.addSymbol(symbol);
45
+ },
46
+
47
+ addBuiltin: function(name) {
48
+ var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment(""));
49
+ builtin.isNamespace = true;
50
+ builtin.srcFile = "";
51
+ builtin.isPrivate = false;
52
+ JSDOC.Parser.addSymbol(builtin);
53
+ return builtin;
54
+ },
55
+
56
+ init: function() {
57
+ JSDOC.Parser.symbols = new JSDOC.SymbolSet();
58
+ JSDOC.Parser.walker = new JSDOC.Walker();
59
+ },
60
+
61
+ finish: function() {
62
+ JSDOC.Parser.symbols.relate();
63
+
64
+ // make a litle report about what was found
65
+ if (JSDOC.Parser.conf.explain) {
66
+ var symbols = JSDOC.Parser.symbols.toArray();
67
+ var srcFile = "";
68
+ for (var i = 0, l = symbols.length; i < l; i++) {
69
+ var symbol = symbols[i];
70
+ if (srcFile != symbol.srcFile) {
71
+ srcFile = symbol.srcFile;
72
+ print("\n"+srcFile+"\n-------------------");
73
+ }
74
+ 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+ ", isPrivate => " + symbol.isPrivate);
75
+ }
76
+ print("-------------------\n");
77
+ }
78
+ }
79
+ }
80
+
81
+ JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) {
82
+ JSDOC.Symbol.srcFile = (srcFile || "");
83
+ JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries
84
+
85
+ if (!JSDOC.Parser.walker) JSDOC.Parser.init();
86
+ JSDOC.Parser.walker.walk(ts); // adds to our symbols
87
+
88
+ // filter symbols by option
89
+ for (var p = JSDOC.Parser.symbols._index.first(); p; p = JSDOC.Parser.symbols._index.next()) {
90
+ var symbol = p.value;
91
+
92
+ if (!symbol) continue;
93
+
94
+ if (symbol.is("FILE") || symbol.is("GLOBAL")) {
95
+ continue;
96
+ }
97
+ else if (!JSDOC.opt.a && !symbol.comment.isUserComment) {
98
+ JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
99
+ }
100
+
101
+ if (/#$/.test(symbol.alias)) { // we don't document prototypes
102
+ JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
103
+ }
104
+ }
105
+
106
+ return JSDOC.Parser.symbols.toArray();
107
+ }