jsdoc-toolkit 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/jsdoc-toolkit.gemspec +108 -1
  4. data/src/jsdoc-toolkit/jsdoc-toolkit/README.txt +183 -0
  5. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame.js +33 -0
  6. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Chain.js +102 -0
  7. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  8. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Hash.js +84 -0
  9. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Link.js +153 -0
  10. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  11. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Opt.js +134 -0
  12. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  13. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/String.js +93 -0
  14. data/src/jsdoc-toolkit/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  15. data/src/jsdoc-toolkit/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  16. data/src/jsdoc-toolkit/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  17. data/src/jsdoc-toolkit/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  18. data/src/jsdoc-toolkit/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  19. data/src/jsdoc-toolkit/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  20. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC.js +104 -0
  21. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
  22. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
  23. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
  24. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  25. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  26. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/Parser.js +145 -0
  27. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  28. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +645 -0
  29. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +241 -0
  30. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  31. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  32. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  33. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  34. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  35. data/src/jsdoc-toolkit/jsdoc-toolkit/app/lib/JSDOC/Walker.js +474 -0
  36. data/src/jsdoc-toolkit/jsdoc-toolkit/app/main.js +111 -0
  37. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  38. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  39. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  40. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
  41. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
  42. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  43. data/src/jsdoc-toolkit/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  44. data/src/jsdoc-toolkit/jsdoc-toolkit/app/run.js +348 -0
  45. data/src/jsdoc-toolkit/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  46. data/src/jsdoc-toolkit/jsdoc-toolkit/app/t/runner.js +13 -0
  47. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test.js +325 -0
  48. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/addon.js +24 -0
  49. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  50. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/augments.js +31 -0
  51. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/augments2.js +26 -0
  52. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/borrows.js +46 -0
  53. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/borrows2.js +23 -0
  54. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/config.js +22 -0
  55. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/constructs.js +18 -0
  56. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/encoding.js +10 -0
  57. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  58. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/event.js +54 -0
  59. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/exports.js +14 -0
  60. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  61. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  62. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/global.js +13 -0
  63. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/globals.js +25 -0
  64. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/ignore.js +10 -0
  65. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/inner.js +16 -0
  66. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  67. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/lend.js +33 -0
  68. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/memberof.js +19 -0
  69. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  70. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/module.js +17 -0
  71. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/name.js +19 -0
  72. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  73. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/nocode.js +13 -0
  74. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  75. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/overview.js +20 -0
  76. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/param_inline.js +37 -0
  77. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/params_optional.js +8 -0
  78. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/prototype.js +17 -0
  79. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  80. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  81. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  82. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/public.js +10 -0
  83. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/scripts/code.js +5 -0
  84. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
  85. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/shared.js +42 -0
  86. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/shared2.js +2 -0
  87. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  88. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/static_this.js +13 -0
  89. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/synonyms.js +31 -0
  90. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/tosource.js +23 -0
  91. data/src/jsdoc-toolkit/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  92. data/src/jsdoc-toolkit/jsdoc-toolkit/changes.txt +107 -0
  93. data/src/jsdoc-toolkit/jsdoc-toolkit/conf/sample.conf +31 -0
  94. data/src/jsdoc-toolkit/jsdoc-toolkit/java/build.xml +36 -0
  95. data/src/jsdoc-toolkit/jsdoc-toolkit/java/build_1.4.xml +36 -0
  96. data/src/jsdoc-toolkit/jsdoc-toolkit/java/classes/js.jar +0 -0
  97. data/src/jsdoc-toolkit/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  98. data/src/jsdoc-toolkit/jsdoc-toolkit/java/src/JsRun.java +21 -0
  99. data/src/jsdoc-toolkit/jsdoc-toolkit/jsdebug.jar +0 -0
  100. data/src/jsdoc-toolkit/jsdoc-toolkit/jsrun.jar +0 -0
  101. data/src/jsdoc-toolkit/jsdoc-toolkit/jsrun.sh +52 -0
  102. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  103. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  104. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/class.tmpl +649 -0
  105. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  106. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/publish.js +200 -0
  107. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  108. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  109. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  110. data/src/jsdoc-toolkit/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  111. metadata +108 -1
@@ -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,145 @@
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
+
19
+ if (JSDOC.Parser.rename) {
20
+ for (var n in JSDOC.Parser.rename) {
21
+ if (symbol.alias.indexOf(n) == 0) {
22
+ if (symbol.name == symbol.alias) {
23
+ symbol.name = symbol.name.replace(n, JSDOC.Parser.rename[n]);
24
+ }
25
+ symbol.alias = symbol.alias.replace(n, JSDOC.Parser.rename[n]);
26
+ }
27
+ }
28
+ }
29
+
30
+ if (JSDOC.opt.S) {
31
+ if (typeof JSDOC.Parser.secureModules == "undefined") JSDOC.Parser.secureModules = {};
32
+ if (/^exports\./.test(symbol.alias)) {
33
+ symbol.srcFile.match(/(^|[\\\/])([^\\\/]+)\.js/i);
34
+ var fileNS = RegExp.$2;
35
+ symbol.alias = symbol.alias.replace(/^exports\./, fileNS);
36
+ symbol.name = symbol.name.replace(/^exports\./, "");
37
+ symbol.memberOf = fileNS;
38
+
39
+ // need to create the namespace associated with this file first
40
+ if (!JSDOC.Parser.secureModules[fileNS]) {
41
+ JSDOC.Parser.secureModules[fileNS] = 1;
42
+ var nsSymbol = new JSDOC.Symbol(fileNS, [], "GLOBAL", new JSDOC.DocComment(""));
43
+ nsSymbol.isNamespace = true;
44
+ nsSymbol.srcFile = "";
45
+ nsSymbol.isPrivate = false;
46
+ nsSymbol.srcFile = symbol.srcFile;
47
+ nsSymbol.desc = (JSDOC.Parser.symbols.getSymbol(symbol.srcFile) || {desc: ""}).desc;
48
+ JSDOC.Parser.addSymbol(nsSymbol);
49
+
50
+ }
51
+ }
52
+ else { // a method that is not exported?
53
+ if (!symbol.isNamespace) return;
54
+ }
55
+ }
56
+ // if a symbol alias is documented more than once the last one with the user docs wins
57
+ if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) {
58
+ var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias);
59
+ if (oldSymbol.comment.isUserComment) {
60
+ if (symbol.comment.isUserComment) { // old and new are both documented
61
+ LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
62
+ }
63
+ else { // old is documented but new isn't
64
+ return;
65
+ }
66
+ }
67
+ }
68
+
69
+ // we don't document anonymous things
70
+ if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
71
+
72
+ // uderscored things may be treated as if they were marked private, this cascades
73
+ if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
74
+ if (!symbol.comment.getTag("public").length > 0) symbol.isPrivate = true;
75
+ }
76
+
77
+ // -p flag is required to document private things
78
+ if (!JSDOC.opt.p && symbol.isPrivate) return; // issue #161 fixed by mcbain.asm
79
+
80
+ // ignored things are not documented, this doesn't cascade
81
+ if (symbol.isIgnored) return;
82
+ JSDOC.Parser.symbols.addSymbol(symbol);
83
+ },
84
+
85
+ addBuiltin: function(name) {
86
+ var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment(""));
87
+ builtin.isNamespace = true;
88
+ builtin.srcFile = "";
89
+ builtin.isPrivate = false;
90
+ JSDOC.Parser.addSymbol(builtin);
91
+ return builtin;
92
+ },
93
+
94
+ init: function() {
95
+ JSDOC.Parser.symbols = new JSDOC.SymbolSet();
96
+ JSDOC.Parser.walker = new JSDOC.Walker();
97
+ },
98
+
99
+ finish: function() {
100
+ JSDOC.Parser.symbols.relate();
101
+
102
+ // make a litle report about what was found
103
+ if (JSDOC.Parser.conf.explain) {
104
+ var symbols = JSDOC.Parser.symbols.toArray();
105
+ var srcFile = "";
106
+ for (var i = 0, l = symbols.length; i < l; i++) {
107
+ var symbol = symbols[i];
108
+ if (srcFile != symbol.srcFile) {
109
+ srcFile = symbol.srcFile;
110
+ print("\n"+srcFile+"\n-------------------");
111
+ }
112
+ 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);
113
+ }
114
+ print("-------------------\n");
115
+ }
116
+ }
117
+ }
118
+
119
+ JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) {
120
+ JSDOC.Symbol.srcFile = (srcFile || "");
121
+ JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries
122
+
123
+ if (!JSDOC.Parser.walker) JSDOC.Parser.init();
124
+ JSDOC.Parser.walker.walk(ts); // adds to our symbols
125
+
126
+ // filter symbols by option
127
+ for (var p = JSDOC.Parser.symbols._index.first(); p; p = JSDOC.Parser.symbols._index.next()) {
128
+ var symbol = p.value;
129
+
130
+ if (!symbol) continue;
131
+
132
+ if (symbol.is("FILE") || symbol.is("GLOBAL")) {
133
+ continue;
134
+ }
135
+ else if (!JSDOC.opt.a && !symbol.comment.isUserComment) {
136
+ JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
137
+ }
138
+
139
+ if (/#$/.test(symbol.alias)) { // we don't document prototypes
140
+ JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
141
+ }
142
+ }
143
+
144
+ return JSDOC.Parser.symbols.toArray();
145
+ }
@@ -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
+ }
@@ -0,0 +1,645 @@
1
+ if (typeof JSDOC == "undefined") JSDOC = {};
2
+
3
+ /**
4
+ Create a new Symbol.
5
+ @class Represents a symbol in the source code.
6
+ */
7
+ JSDOC.Symbol = function() {
8
+ this.init();
9
+ if (arguments.length) this.populate.apply(this, arguments);
10
+ }
11
+
12
+ JSDOC.Symbol.count = 0;
13
+
14
+ JSDOC.Symbol.prototype.init = function() {
15
+ this._name = "";
16
+ this._params = [];
17
+ this.$args = [];
18
+ this.addOn = "";
19
+ this.alias = "";
20
+ this.augments = [];
21
+ this.author = "";
22
+ this.classDesc = "";
23
+ this.comment = {};
24
+ this.defaultValue = undefined;
25
+ this.deprecated = "";
26
+ this.desc = "";
27
+ this.example = [];
28
+ this.exceptions = [];
29
+ this.fires = [];
30
+ this.id = JSDOC.Symbol.count++;
31
+ this.inherits = [];
32
+ this.inheritsFrom = [];
33
+ this.isa = "OBJECT";
34
+ this.isConstant = false;
35
+ this.isEvent = false;
36
+ this.isIgnored = false;
37
+ this.isInner = false;
38
+ this.isNamespace = false;
39
+ this.isPrivate = false;
40
+ this.isStatic = false;
41
+ this.memberOf = "";
42
+ this.methods = [];
43
+ this.properties = [];
44
+ this.requires = [];
45
+ this.returns = [];
46
+ this.see = [];
47
+ this.since = "";
48
+ this.srcFile = {};
49
+ this.type = "";
50
+ this.version = "";
51
+ }
52
+
53
+ JSDOC.Symbol.prototype.serialize = function() {
54
+ var keys = [];
55
+ for (var p in this) {
56
+ keys.push (p);
57
+ }
58
+ keys = keys.sort();
59
+
60
+ var out = "";
61
+ for (var i in keys) {
62
+ if (typeof this[keys[i]] == "function") continue;
63
+ out += keys[i]+" => "+Dumper.dump(this[keys[i]])+",\n";
64
+ }
65
+ return "\n{\n" + out + "}\n";
66
+ }
67
+
68
+ JSDOC.Symbol.prototype.clone = function() {
69
+ var clone = new JSDOC.Symbol();
70
+ clone.populate.apply(clone, this.$args); // repopulate using the original arguments
71
+ clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made
72
+ return clone;
73
+ }
74
+
75
+ JSDOC.Symbol.prototype.__defineSetter__("name",
76
+ function(n) { n = n.replace(/^_global_[.#-]/, ""); n = n.replace(/\.prototype\.?/g, '#'); this._name = n; }
77
+ );
78
+ JSDOC.Symbol.prototype.__defineGetter__("name",
79
+ function() { return this._name; }
80
+ );
81
+ JSDOC.Symbol.prototype.__defineSetter__("params",
82
+ function(v) {
83
+ for (var i = 0, l = v.length; i < l; i++) {
84
+ if (v[i].constructor != JSDOC.DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
85
+ this._params[i] = new JSDOC.DocTag("param"+((v[i].type)?" {"+v[i].type+"}":"")+" "+v[i].name);
86
+ }
87
+ else {
88
+ this._params[i] = v[i];
89
+ }
90
+ }
91
+ }
92
+ );
93
+ JSDOC.Symbol.prototype.__defineGetter__("params",
94
+ function() { return this._params; }
95
+ );
96
+
97
+ JSDOC.Symbol.prototype.getEvents = function() {
98
+ var events = [];
99
+ for (var i = 0, l = this.methods.length; i < l; i++) {
100
+ if (this.methods[i].isEvent) {
101
+ this.methods[i].name = this.methods[i].name.replace("event:", "");
102
+ events.push(this.methods[i]);
103
+ }
104
+ }
105
+ return events;
106
+ }
107
+
108
+ JSDOC.Symbol.prototype.getMethods = function() {
109
+ var nonEvents = [];
110
+ for (var i = 0, l = this.methods.length; i < l; i++) {
111
+ if (!this.methods[i].isEvent) {
112
+ nonEvents.push(this.methods[i]);
113
+ }
114
+ }
115
+ return nonEvents;
116
+ }
117
+
118
+
119
+ JSDOC.Symbol.prototype.populate = function(
120
+ /** String */ name,
121
+ /** Object[] */ params,
122
+ /** String */ isa,
123
+ /** JSDOC.DocComment */ comment
124
+ ) {
125
+ this.$args = arguments;
126
+
127
+ this.name = name;
128
+ this.alias = this.name;
129
+
130
+ this.params = params;
131
+ this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
132
+ this.comment = comment || new JSDOC.DocComment("");
133
+ this.srcFile = JSDOC.Symbol.srcFile;
134
+
135
+ if (this.is("FILE") && !this.alias) this.alias = this.srcFile;
136
+
137
+ this.setTags();
138
+
139
+ if (typeof JSDOC.PluginManager != "undefined") {
140
+ JSDOC.PluginManager.run("onSymbol", this);
141
+ }
142
+ }
143
+
144
+ JSDOC.Symbol.prototype.setTags = function() {
145
+ // @author
146
+ var authors = this.comment.getTag("author");
147
+ if (authors.length) {
148
+ this.author = authors.map(function($){return $.desc;}).join(", ");
149
+ }
150
+
151
+ /*t:
152
+ plan(34, "testing JSDOC.Symbol");
153
+
154
+ requires("../lib/JSDOC/DocComment.js");
155
+ requires("../frame/String.js");
156
+ requires("../lib/JSDOC/DocTag.js");
157
+
158
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@author Joe Smith*"+"/"));
159
+ is(sym.author, "Joe Smith", "@author tag, author is found.");
160
+ */
161
+
162
+ // @desc
163
+ var descs = this.comment.getTag("desc");
164
+ if (descs.length) {
165
+ this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
166
+ }
167
+
168
+ /*t:
169
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@desc This is a description.*"+"/"));
170
+ is(sym.desc, "This is a description.", "@desc tag, description is found.");
171
+ */
172
+
173
+ // @overview
174
+ if (this.is("FILE")) {
175
+ if (!this.alias) this.alias = this.srcFile;
176
+
177
+ var overviews = this.comment.getTag("overview");
178
+ if (overviews.length) {
179
+ this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
180
+ }
181
+ }
182
+
183
+ /*t:
184
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@overview This is an overview.*"+"/"));
185
+ is(sym.desc, "\nThis is an overview.", "@overview tag, description is found.");
186
+ */
187
+
188
+ // @since
189
+ var sinces = this.comment.getTag("since");
190
+ if (sinces.length) {
191
+ this.since = sinces.map(function($){return $.desc;}).join(", ");
192
+ }
193
+
194
+ /*t:
195
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@since 1.01*"+"/"));
196
+ is(sym.since, "1.01", "@since tag, description is found.");
197
+ */
198
+
199
+ // @constant
200
+ if (this.comment.getTag("constant").length) {
201
+ this.isConstant = true;
202
+ }
203
+
204
+ /*t:
205
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@constant*"+"/"));
206
+ is(sym.isConstant, true, "@constant tag, isConstant set.");
207
+ */
208
+
209
+ // @version
210
+ var versions = this.comment.getTag("version");
211
+ if (versions.length) {
212
+ this.version = versions.map(function($){return $.desc;}).join(", ");
213
+ }
214
+
215
+ /*t:
216
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@version 2.0x*"+"/"));
217
+ is(sym.version, "2.0x", "@version tag, version is found.");
218
+ */
219
+
220
+ // @deprecated
221
+ var deprecateds = this.comment.getTag("deprecated");
222
+ if (deprecateds.length) {
223
+ this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
224
+ }
225
+
226
+ /*t:
227
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@deprecated Use other method.*"+"/"));
228
+ is(sym.deprecated, "Use other method.", "@deprecated tag, desc is found.");
229
+ */
230
+
231
+ // @example
232
+ var examples = this.comment.getTag("example");
233
+ if (examples.length) {
234
+ this.example = examples.map(
235
+ // trim trailing whitespace
236
+ function($) {
237
+ $.desc = $.desc.replace(/\s+$/, "");
238
+ return $;
239
+ }
240
+ );
241
+ }
242
+
243
+ /*t:
244
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@example This\n is an example. \n*"+"/"));
245
+ isnt(typeof sym.example[0], "undefined", "@example tag, creates sym.example array.");
246
+ is(sym.example[0], "This\n is an example.", "@example tag, desc is found.");
247
+ */
248
+
249
+ // @see
250
+ var sees = this.comment.getTag("see");
251
+ if (sees.length) {
252
+ var thisSee = this.see;
253
+ sees.map(function($){thisSee.push($.desc);});
254
+ }
255
+
256
+ /*t:
257
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@see The other thing.*"+"/"));
258
+ is(sym.see, "The other thing.", "@see tag, desc is found.");
259
+ */
260
+
261
+ // @class
262
+ var classes = this.comment.getTag("class");
263
+ if (classes.length) {
264
+ this.isa = "CONSTRUCTOR";
265
+ this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none.
266
+ }
267
+
268
+ /*t:
269
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@class This describes the class.*"+"/"));
270
+ is(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor.");
271
+ is(sym.classDesc, "This describes the class.", "@class tag, class description is found.");
272
+ */
273
+
274
+ // @namespace
275
+ var namespaces = this.comment.getTag("namespace");
276
+ if (namespaces.length) {
277
+ this.classDesc = namespaces[0].desc;
278
+ this.isNamespace = true;
279
+ }
280
+
281
+ /*t:
282
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@namespace This describes the namespace.*"+"/"));
283
+ is(sym.classDesc, "This describes the namespace.", "@namespace tag, class description is found.");
284
+ */
285
+
286
+ // @param
287
+ var params = this.comment.getTag("param");
288
+ if (params.length) {
289
+ // user-defined params overwrite those with same name defined by the parser
290
+ var thisParams = this.params;
291
+
292
+ if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
293
+ this.params = params;
294
+ }
295
+ else { // need to overlay these user-defined params on to existing parser-defined params
296
+ for (var i = 0, l = params.length; i < l; i++) {
297
+ if (thisParams[i]) {
298
+ if (params[i].type) thisParams[i].type = params[i].type;
299
+ thisParams[i].name = params[i].name;
300
+ thisParams[i].desc = params[i].desc;
301
+ thisParams[i].isOptional = params[i].isOptional;
302
+ thisParams[i].defaultValue = params[i].defaultValue;
303
+ }
304
+ else thisParams[i] = params[i];
305
+ }
306
+ }
307
+ }
308
+
309
+ /*t:
310
+ var sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.*"+"/"));
311
+ is(sym.params.length, 1, "parser defined param is found.");
312
+
313
+ sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages*"+"/"));
314
+ is(sym.params.length, 1, "user defined param is found.");
315
+ is(sym.params[0].type, "array", "user defined param type is found.");
316
+ is(sym.params[0].name, "pages", "user defined param name is found.");
317
+
318
+ sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
319
+ is(sym.params.length, 1, "user defined param overwrites parser defined param.");
320
+ is(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
321
+ is(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
322
+
323
+ sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
324
+ is(sym.params.length, 2, "user defined params overlay parser defined params.");
325
+ is(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
326
+ is(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
327
+
328
+ sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
329
+ is(sym.params.length, 1, "user defined param with description is found.");
330
+ is(sym.params[0].desc, "The pages description.", "user defined param description is found.");
331
+ */
332
+
333
+ // @constructor
334
+ if (this.comment.getTag("constructor").length) {
335
+ this.isa = "CONSTRUCTOR";
336
+ }
337
+
338
+ /*t:
339
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@constructor*"+"/"));
340
+ is(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor.");
341
+ */
342
+
343
+ // @static
344
+ if (this.comment.getTag("static").length) {
345
+ this.isStatic = true;
346
+ if (this.isa == "CONSTRUCTOR") {
347
+ this.isNamespace = true;
348
+ }
349
+ }
350
+
351
+ /*t:
352
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@static\n@constructor*"+"/"));
353
+ is(sym.isStatic, true, "@static tag, makes isStatic true.");
354
+ is(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true.");
355
+ */
356
+
357
+ // @inner
358
+ if (this.comment.getTag("inner").length) {
359
+ this.isInner = true;
360
+ this.isStatic = false;
361
+ }
362
+
363
+ /*t:
364
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@inner*"+"/"));
365
+ is(sym.isStatic, false, "@inner tag, makes isStatic false.");
366
+ is(sym.isInner, true, "@inner makes isInner true.");
367
+ */
368
+
369
+ // @name
370
+ var names = this.comment.getTag("name");
371
+ if (names.length) {
372
+ this.name = names[0].desc;
373
+ }
374
+
375
+ /*t:
376
+ // todo
377
+ */
378
+
379
+ // @field
380
+ if (this.comment.getTag("field").length) {
381
+ this.isa = "OBJECT";
382
+ }
383
+
384
+ /*t:
385
+ var sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**@field*"+"/"));
386
+ is(sym.isa, "OBJECT", "@field tag, makes symbol an object.");
387
+ */
388
+
389
+ // @function
390
+ if (this.comment.getTag("function").length) {
391
+ this.isa = "FUNCTION";
392
+ if (/event:/.test(this.alias)) this.isEvent = true;
393
+ }
394
+
395
+ /*t:
396
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@function*"+"/"));
397
+ is(sym.isa, "FUNCTION", "@function tag, makes symbol a function.");
398
+ */
399
+
400
+ // @event
401
+ var events = this.comment.getTag("event");
402
+ if (events.length) {
403
+ this.isa = "FUNCTION";
404
+ this.isEvent = true;
405
+ if (!/event:/.test(this.alias))
406
+ this.alias = this.alias.replace(/^(.*[.#-])([^.#-]+)$/, "$1event:$2");
407
+ }
408
+
409
+ /*t:
410
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@event*"+"/"));
411
+ is(sym.isa, "FUNCTION", "@event tag, makes symbol a function.");
412
+ is(sym.isEvent, true, "@event makes isEvent true.");
413
+ */
414
+
415
+ // @fires
416
+ var fires = this.comment.getTag("fires");
417
+ if (fires.length) {
418
+ for (var i = 0; i < fires.length; i++) {
419
+ this.fires.push(fires[i].desc);
420
+ }
421
+ }
422
+
423
+ /*t:
424
+ // todo
425
+ */
426
+
427
+ // @property
428
+ var properties = this.comment.getTag("property");
429
+ if (properties.length) {
430
+ thisProperties = this.properties;
431
+ for (var i = 0; i < properties.length; i++) {
432
+ var property = new JSDOC.Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new JSDOC.DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/"));
433
+ // TODO: shouldn't the following happen in the addProperty method of Symbol?
434
+ property.name = properties[i].name;
435
+ property.memberOf = this.alias;
436
+ if (properties[i].type) property.type = properties[i].type;
437
+ if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
438
+ this.addProperty(property);
439
+ JSDOC.Parser.addSymbol(property);
440
+ }
441
+ }
442
+
443
+ /*t:
444
+ // todo
445
+ */
446
+
447
+ // @return
448
+ var returns = this.comment.getTag("return");
449
+ if (returns.length) { // there can be many return tags in a single doclet
450
+ this.returns = returns;
451
+ this.type = returns.map(function($){return $.type}).join(", ");
452
+ }
453
+
454
+ /*t:
455
+ // todo
456
+ */
457
+
458
+ // @exception
459
+ this.exceptions = this.comment.getTag("throws");
460
+
461
+ /*t:
462
+ // todo
463
+ */
464
+
465
+ // @requires
466
+ var requires = this.comment.getTag("requires");
467
+ if (requires.length) {
468
+ this.requires = requires.map(function($){return $.desc});
469
+ }
470
+
471
+ /*t:
472
+ // todo
473
+ */
474
+
475
+ // @type
476
+ var types = this.comment.getTag("type");
477
+ if (types.length) {
478
+ this.type = types[0].desc; //multiple type tags are ignored
479
+ }
480
+
481
+ /*t:
482
+ // todo
483
+ */
484
+
485
+ // @private
486
+ if (this.comment.getTag("private").length || this.isInner) {
487
+ this.isPrivate = true;
488
+ }
489
+
490
+ // @ignore
491
+ if (this.comment.getTag("ignore").length) {
492
+ this.isIgnored = true;
493
+ }
494
+
495
+ /*t:
496
+ // todo
497
+ */
498
+
499
+ // @inherits ... as ...
500
+ var inherits = this.comment.getTag("inherits");
501
+ if (inherits.length) {
502
+ for (var i = 0; i < inherits.length; i++) {
503
+ if (/^\s*([a-z$0-9_.#:-]+)(?:\s+as\s+([a-z$0-9_.#:-]+))?/i.test(inherits[i].desc)) {
504
+ var inAlias = RegExp.$1;
505
+ var inAs = RegExp.$2 || inAlias;
506
+
507
+ if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#");
508
+
509
+ if (inAs) {
510
+ inAs = inAs.replace(/\.prototype\.?/g, "#");
511
+ inAs = inAs.replace(/^this\.?/, "#");
512
+ }
513
+
514
+ if (inAs.indexOf(inAlias) != 0) { //not a full namepath
515
+ var joiner = ".";
516
+ if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") {
517
+ joiner = "";
518
+ }
519
+ inAs = this.alias + joiner + inAs;
520
+ }
521
+ }
522
+ this.inherits.push({alias: inAlias, as: inAs});
523
+ }
524
+ }
525
+
526
+ /*t:
527
+ // todo
528
+ */
529
+
530
+ // @augments
531
+ this.augments = this.comment.getTag("augments");
532
+
533
+ // @default
534
+ var defaults = this.comment.getTag("default");
535
+ if (defaults.length) {
536
+ if (this.is("OBJECT")) {
537
+ this.defaultValue = defaults[0].desc;
538
+ }
539
+ }
540
+
541
+ /*t:
542
+ // todo
543
+ */
544
+
545
+ // @memberOf
546
+ var memberOfs = this.comment.getTag("memberOf");
547
+ if (memberOfs.length) {
548
+ this.memberOf = memberOfs[0].desc;
549
+ this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#");
550
+ }
551
+
552
+ /*t:
553
+ // todo
554
+ */
555
+
556
+ // @public
557
+ if (this.comment.getTag("public").length) {
558
+ this.isPrivate = false;
559
+ }
560
+
561
+ /*t:
562
+ // todo
563
+ */
564
+
565
+ if (JSDOC.PluginManager) {
566
+ JSDOC.PluginManager.run("onSetTags", this);
567
+ }
568
+ }
569
+
570
+ JSDOC.Symbol.prototype.is = function(what) {
571
+ return this.isa === what;
572
+ }
573
+
574
+ JSDOC.Symbol.prototype.isBuiltin = function() {
575
+ return JSDOC.Lang.isBuiltin(this.alias);
576
+ }
577
+
578
+ JSDOC.Symbol.prototype.setType = function(/**String*/comment, /**Boolean*/overwrite) {
579
+ if (!overwrite && this.type) return;
580
+ var typeComment = JSDOC.DocComment.unwrapComment(comment);
581
+ this.type = typeComment;
582
+ }
583
+
584
+ JSDOC.Symbol.prototype.inherit = function(symbol) {
585
+ if (!this.hasMember(symbol.name) && !symbol.isInner) {
586
+ if (symbol.is("FUNCTION"))
587
+ this.methods.push(symbol);
588
+ else if (symbol.is("OBJECT"))
589
+ this.properties.push(symbol);
590
+ }
591
+ }
592
+
593
+ JSDOC.Symbol.prototype.hasMember = function(name) {
594
+ return (this.hasMethod(name) || this.hasProperty(name));
595
+ }
596
+
597
+ JSDOC.Symbol.prototype.addMember = function(symbol) {
598
+ if (symbol.is("FUNCTION")) { this.addMethod(symbol); }
599
+ else if (symbol.is("OBJECT")) { this.addProperty(symbol); }
600
+ }
601
+
602
+ JSDOC.Symbol.prototype.hasMethod = function(name) {
603
+ var thisMethods = this.methods;
604
+ for (var i = 0, l = thisMethods.length; i < l; i++) {
605
+ if (thisMethods[i].name == name) return true;
606
+ if (thisMethods[i].alias == name) return true;
607
+ }
608
+ return false;
609
+ }
610
+
611
+ JSDOC.Symbol.prototype.addMethod = function(symbol) {
612
+ var methodAlias = symbol.alias;
613
+ var thisMethods = this.methods;
614
+ for (var i = 0, l = thisMethods.length; i < l; i++) {
615
+ if (thisMethods[i].alias == methodAlias) {
616
+ thisMethods[i] = symbol; // overwriting previous method
617
+ return;
618
+ }
619
+ }
620
+ thisMethods.push(symbol); // new method with this alias
621
+ }
622
+
623
+ JSDOC.Symbol.prototype.hasProperty = function(name) {
624
+ var thisProperties = this.properties;
625
+ for (var i = 0, l = thisProperties.length; i < l; i++) {
626
+ if (thisProperties[i].name == name) return true;
627
+ if (thisProperties[i].alias == name) return true;
628
+ }
629
+ return false;
630
+ }
631
+
632
+ JSDOC.Symbol.prototype.addProperty = function(symbol) {
633
+ var propertyAlias = symbol.alias;
634
+ var thisProperties = this.properties;
635
+ for (var i = 0, l = thisProperties.length; i < l; i++) {
636
+ if (thisProperties[i].alias == propertyAlias) {
637
+ thisProperties[i] = symbol; // overwriting previous property
638
+ return;
639
+ }
640
+ }
641
+
642
+ thisProperties.push(symbol); // new property with this alias
643
+ }
644
+
645
+ JSDOC.Symbol.srcFile = ""; //running reference to the current file being parsed