immosquare-cleaner 0.1.34 → 0.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/lib/immosquare-cleaner.rb +2 -2
- data/linters/eslint.config.mjs +30 -0
- data/linters/rubocop-3.2.2.yml +2 -0
- data/node_modules/function-bind/README.md +27 -25
- data/node_modules/function-bind/implementation.js +12 -44
- data/node_modules/function-bind/package.json +14 -38
- data/node_modules/is-core-module/CHANGELOG.md +0 -7
- data/node_modules/is-core-module/index.js +2 -2
- data/node_modules/is-core-module/package.json +4 -4
- data/package.json +2 -4
- metadata +3 -180
- data/linters/eslintrc.json +0 -57
- data/node_modules/.bin/rimraf +0 -1
- data/node_modules/eslint-config-airbnb-base/CHANGELOG.md +0 -374
- data/node_modules/eslint-config-airbnb-base/LICENSE.md +0 -21
- data/node_modules/eslint-config-airbnb-base/README.md +0 -112
- data/node_modules/eslint-config-airbnb-base/index.js +0 -17
- data/node_modules/eslint-config-airbnb-base/legacy.js +0 -34
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/LICENSE +0 -15
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/README.md +0 -443
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/bin/semver.js +0 -174
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/package.json +0 -38
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/range.bnf +0 -16
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/semver.js +0 -1643
- data/node_modules/eslint-config-airbnb-base/package.json +0 -95
- data/node_modules/eslint-config-airbnb-base/rules/best-practices.js +0 -408
- data/node_modules/eslint-config-airbnb-base/rules/errors.js +0 -179
- data/node_modules/eslint-config-airbnb-base/rules/es6.js +0 -185
- data/node_modules/eslint-config-airbnb-base/rules/imports.js +0 -273
- data/node_modules/eslint-config-airbnb-base/rules/node.js +0 -43
- data/node_modules/eslint-config-airbnb-base/rules/strict.js +0 -6
- data/node_modules/eslint-config-airbnb-base/rules/style.js +0 -529
- data/node_modules/eslint-config-airbnb-base/rules/variables.js +0 -56
- data/node_modules/eslint-config-airbnb-base/test/requires.js +0 -13
- data/node_modules/eslint-config-airbnb-base/test/test-base.js +0 -32
- data/node_modules/eslint-config-airbnb-base/whitespace-async.js +0 -96
- data/node_modules/eslint-config-airbnb-base/whitespace.js +0 -102
- data/node_modules/eslint-plugin-import/CHANGELOG.md +0 -1925
- data/node_modules/eslint-plugin-import/CONTRIBUTING.md +0 -84
- data/node_modules/eslint-plugin-import/LICENSE +0 -22
- data/node_modules/eslint-plugin-import/README.md +0 -500
- data/node_modules/eslint-plugin-import/RELEASE.md +0 -54
- data/node_modules/eslint-plugin-import/SECURITY.md +0 -11
- data/node_modules/eslint-plugin-import/config/electron.js +0 -8
- data/node_modules/eslint-plugin-import/config/errors.js +0 -14
- data/node_modules/eslint-plugin-import/config/react-native.js +0 -13
- data/node_modules/eslint-plugin-import/config/react.js +0 -18
- data/node_modules/eslint-plugin-import/config/recommended.js +0 -28
- data/node_modules/eslint-plugin-import/config/stage-0.js +0 -12
- data/node_modules/eslint-plugin-import/config/typescript.js +0 -34
- data/node_modules/eslint-plugin-import/config/warnings.js +0 -12
- data/node_modules/eslint-plugin-import/docs/rules/consistent-type-specifier-style.md +0 -91
- data/node_modules/eslint-plugin-import/docs/rules/default.md +0 -72
- data/node_modules/eslint-plugin-import/docs/rules/dynamic-import-chunkname.md +0 -92
- data/node_modules/eslint-plugin-import/docs/rules/export.md +0 -37
- data/node_modules/eslint-plugin-import/docs/rules/exports-last.md +0 -51
- data/node_modules/eslint-plugin-import/docs/rules/extensions.md +0 -174
- data/node_modules/eslint-plugin-import/docs/rules/first.md +0 -75
- data/node_modules/eslint-plugin-import/docs/rules/group-exports.md +0 -118
- data/node_modules/eslint-plugin-import/docs/rules/imports-first.md +0 -9
- data/node_modules/eslint-plugin-import/docs/rules/max-dependencies.md +0 -70
- data/node_modules/eslint-plugin-import/docs/rules/named.md +0 -102
- data/node_modules/eslint-plugin-import/docs/rules/namespace.md +0 -106
- data/node_modules/eslint-plugin-import/docs/rules/newline-after-import.md +0 -167
- data/node_modules/eslint-plugin-import/docs/rules/no-absolute-path.md +0 -54
- data/node_modules/eslint-plugin-import/docs/rules/no-amd.md +0 -37
- data/node_modules/eslint-plugin-import/docs/rules/no-anonymous-default-export.md +0 -83
- data/node_modules/eslint-plugin-import/docs/rules/no-commonjs.md +0 -96
- data/node_modules/eslint-plugin-import/docs/rules/no-cycle.md +0 -111
- data/node_modules/eslint-plugin-import/docs/rules/no-default-export.md +0 -65
- data/node_modules/eslint-plugin-import/docs/rules/no-deprecated.md +0 -62
- data/node_modules/eslint-plugin-import/docs/rules/no-duplicates.md +0 -109
- data/node_modules/eslint-plugin-import/docs/rules/no-dynamic-require.md +0 -25
- data/node_modules/eslint-plugin-import/docs/rules/no-empty-named-blocks.md +0 -49
- data/node_modules/eslint-plugin-import/docs/rules/no-extraneous-dependencies.md +0 -139
- data/node_modules/eslint-plugin-import/docs/rules/no-import-module-exports.md +0 -81
- data/node_modules/eslint-plugin-import/docs/rules/no-internal-modules.md +0 -136
- data/node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md +0 -54
- data/node_modules/eslint-plugin-import/docs/rules/no-named-as-default-member.md +0 -52
- data/node_modules/eslint-plugin-import/docs/rules/no-named-as-default.md +0 -53
- data/node_modules/eslint-plugin-import/docs/rules/no-named-default.md +0 -36
- data/node_modules/eslint-plugin-import/docs/rules/no-named-export.md +0 -79
- data/node_modules/eslint-plugin-import/docs/rules/no-namespace.md +0 -44
- data/node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md +0 -42
- data/node_modules/eslint-plugin-import/docs/rules/no-relative-packages.md +0 -70
- data/node_modules/eslint-plugin-import/docs/rules/no-relative-parent-imports.md +0 -123
- data/node_modules/eslint-plugin-import/docs/rules/no-restricted-paths.md +0 -198
- data/node_modules/eslint-plugin-import/docs/rules/no-self-import.md +0 -32
- data/node_modules/eslint-plugin-import/docs/rules/no-unassigned-import.md +0 -60
- data/node_modules/eslint-plugin-import/docs/rules/no-unresolved.md +0 -110
- data/node_modules/eslint-plugin-import/docs/rules/no-unused-modules.md +0 -125
- data/node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md +0 -85
- data/node_modules/eslint-plugin-import/docs/rules/no-webpack-loader-syntax.md +0 -39
- data/node_modules/eslint-plugin-import/docs/rules/order.md +0 -365
- data/node_modules/eslint-plugin-import/docs/rules/prefer-default-export.md +0 -185
- data/node_modules/eslint-plugin-import/docs/rules/unambiguous.md +0 -57
- data/node_modules/eslint-plugin-import/lib/ExportMap.js +0 -856
- data/node_modules/eslint-plugin-import/lib/core/importType.js +0 -129
- data/node_modules/eslint-plugin-import/lib/core/packagePath.js +0 -22
- data/node_modules/eslint-plugin-import/lib/core/staticRequire.js +0 -11
- data/node_modules/eslint-plugin-import/lib/docsUrl.js +0 -8
- data/node_modules/eslint-plugin-import/lib/importDeclaration.js +0 -5
- data/node_modules/eslint-plugin-import/lib/index.js +0 -71
- data/node_modules/eslint-plugin-import/lib/rules/consistent-type-specifier-style.js +0 -221
- data/node_modules/eslint-plugin-import/lib/rules/default.js +0 -40
- data/node_modules/eslint-plugin-import/lib/rules/dynamic-import-chunkname.js +0 -120
- data/node_modules/eslint-plugin-import/lib/rules/export.js +0 -250
- data/node_modules/eslint-plugin-import/lib/rules/exports-last.js +0 -40
- data/node_modules/eslint-plugin-import/lib/rules/extensions.js +0 -193
- data/node_modules/eslint-plugin-import/lib/rules/first.js +0 -144
- data/node_modules/eslint-plugin-import/lib/rules/group-exports.js +0 -155
- data/node_modules/eslint-plugin-import/lib/rules/imports-first.js +0 -16
- data/node_modules/eslint-plugin-import/lib/rules/max-dependencies.js +0 -60
- data/node_modules/eslint-plugin-import/lib/rules/named.js +0 -143
- data/node_modules/eslint-plugin-import/lib/rules/namespace.js +0 -218
- data/node_modules/eslint-plugin-import/lib/rules/newline-after-import.js +0 -237
- data/node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js +0 -40
- data/node_modules/eslint-plugin-import/lib/rules/no-amd.js +0 -47
- data/node_modules/eslint-plugin-import/lib/rules/no-anonymous-default-export.js +0 -103
- data/node_modules/eslint-plugin-import/lib/rules/no-commonjs.js +0 -141
- data/node_modules/eslint-plugin-import/lib/rules/no-cycle.js +0 -158
- data/node_modules/eslint-plugin-import/lib/rules/no-default-export.js +0 -43
- data/node_modules/eslint-plugin-import/lib/rules/no-deprecated.js +0 -138
- data/node_modules/eslint-plugin-import/lib/rules/no-duplicates.js +0 -354
- data/node_modules/eslint-plugin-import/lib/rules/no-dynamic-require.js +0 -77
- data/node_modules/eslint-plugin-import/lib/rules/no-empty-named-blocks.js +0 -105
- data/node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js +0 -301
- data/node_modules/eslint-plugin-import/lib/rules/no-import-module-exports.js +0 -85
- data/node_modules/eslint-plugin-import/lib/rules/no-internal-modules.js +0 -144
- data/node_modules/eslint-plugin-import/lib/rules/no-mutable-exports.js +0 -59
- data/node_modules/eslint-plugin-import/lib/rules/no-named-as-default-member.js +0 -96
- data/node_modules/eslint-plugin-import/lib/rules/no-named-as-default.js +0 -45
- data/node_modules/eslint-plugin-import/lib/rules/no-named-default.js +0 -31
- data/node_modules/eslint-plugin-import/lib/rules/no-named-export.js +0 -39
- data/node_modules/eslint-plugin-import/lib/rules/no-namespace.js +0 -175
- data/node_modules/eslint-plugin-import/lib/rules/no-nodejs-modules.js +0 -44
- data/node_modules/eslint-plugin-import/lib/rules/no-relative-packages.js +0 -71
- data/node_modules/eslint-plugin-import/lib/rules/no-relative-parent-imports.js +0 -48
- data/node_modules/eslint-plugin-import/lib/rules/no-restricted-paths.js +0 -245
- data/node_modules/eslint-plugin-import/lib/rules/no-self-import.js +0 -39
- data/node_modules/eslint-plugin-import/lib/rules/no-unassigned-import.js +0 -79
- data/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js +0 -60
- data/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js +0 -945
- data/node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js +0 -147
- data/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js +0 -26
- data/node_modules/eslint-plugin-import/lib/rules/order.js +0 -785
- data/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js +0 -116
- data/node_modules/eslint-plugin-import/lib/rules/unambiguous.js +0 -38
- data/node_modules/eslint-plugin-import/memo-parser/LICENSE +0 -22
- data/node_modules/eslint-plugin-import/memo-parser/README.md +0 -21
- data/node_modules/eslint-plugin-import/memo-parser/index.js +0 -41
- data/node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md +0 -395
- data/node_modules/eslint-plugin-import/node_modules/debug/LICENSE +0 -19
- data/node_modules/eslint-plugin-import/node_modules/debug/README.md +0 -437
- data/node_modules/eslint-plugin-import/node_modules/debug/node.js +0 -1
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/index.js +0 -162
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/license.md +0 -21
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/package.json +0 -38
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/readme.md +0 -59
- data/node_modules/eslint-plugin-import/node_modules/debug/package.json +0 -51
- data/node_modules/eslint-plugin-import/node_modules/debug/src/browser.js +0 -180
- data/node_modules/eslint-plugin-import/node_modules/debug/src/common.js +0 -249
- data/node_modules/eslint-plugin-import/node_modules/debug/src/index.js +0 -12
- data/node_modules/eslint-plugin-import/node_modules/debug/src/node.js +0 -177
- data/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md +0 -94
- data/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE +0 -177
- data/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler +0 -202
- data/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima +0 -19
- data/node_modules/eslint-plugin-import/node_modules/doctrine/README.md +0 -165
- data/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js +0 -899
- data/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js +0 -1305
- data/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js +0 -35
- data/node_modules/eslint-plugin-import/node_modules/doctrine/package.json +0 -57
- data/node_modules/eslint-plugin-import/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/eslint-plugin-import/node_modules/minimatch/README.md +0 -230
- data/node_modules/eslint-plugin-import/node_modules/minimatch/minimatch.js +0 -947
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/eslint-plugin-import/node_modules/minimatch/package.json +0 -33
- data/node_modules/eslint-plugin-import/node_modules/semver/LICENSE +0 -15
- data/node_modules/eslint-plugin-import/node_modules/semver/README.md +0 -443
- data/node_modules/eslint-plugin-import/node_modules/semver/bin/semver.js +0 -174
- data/node_modules/eslint-plugin-import/node_modules/semver/package.json +0 -38
- data/node_modules/eslint-plugin-import/node_modules/semver/range.bnf +0 -16
- data/node_modules/eslint-plugin-import/node_modules/semver/semver.js +0 -1643
- data/node_modules/eslint-plugin-import/package.json +0 -124
- data/node_modules/function-bind/CHANGELOG.md +0 -136
@@ -1,899 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @fileoverview Main Doctrine object
|
3
|
-
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
4
|
-
* @author Dan Tao <daniel.tao@gmail.com>
|
5
|
-
* @author Andrew Eisenberg <andrew@eisenberg.as>
|
6
|
-
*/
|
7
|
-
|
8
|
-
(function () {
|
9
|
-
'use strict';
|
10
|
-
|
11
|
-
var typed,
|
12
|
-
utility,
|
13
|
-
jsdoc,
|
14
|
-
esutils,
|
15
|
-
hasOwnProperty;
|
16
|
-
|
17
|
-
esutils = require('esutils');
|
18
|
-
typed = require('./typed');
|
19
|
-
utility = require('./utility');
|
20
|
-
|
21
|
-
function sliceSource(source, index, last) {
|
22
|
-
return source.slice(index, last);
|
23
|
-
}
|
24
|
-
|
25
|
-
hasOwnProperty = (function () {
|
26
|
-
var func = Object.prototype.hasOwnProperty;
|
27
|
-
return function hasOwnProperty(obj, name) {
|
28
|
-
return func.call(obj, name);
|
29
|
-
};
|
30
|
-
}());
|
31
|
-
|
32
|
-
function shallowCopy(obj) {
|
33
|
-
var ret = {}, key;
|
34
|
-
for (key in obj) {
|
35
|
-
if (obj.hasOwnProperty(key)) {
|
36
|
-
ret[key] = obj[key];
|
37
|
-
}
|
38
|
-
}
|
39
|
-
return ret;
|
40
|
-
}
|
41
|
-
|
42
|
-
function isASCIIAlphanumeric(ch) {
|
43
|
-
return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
|
44
|
-
(ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
|
45
|
-
(ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
|
46
|
-
}
|
47
|
-
|
48
|
-
function isParamTitle(title) {
|
49
|
-
return title === 'param' || title === 'argument' || title === 'arg';
|
50
|
-
}
|
51
|
-
|
52
|
-
function isReturnTitle(title) {
|
53
|
-
return title === 'return' || title === 'returns';
|
54
|
-
}
|
55
|
-
|
56
|
-
function isProperty(title) {
|
57
|
-
return title === 'property' || title === 'prop';
|
58
|
-
}
|
59
|
-
|
60
|
-
function isNameParameterRequired(title) {
|
61
|
-
return isParamTitle(title) || isProperty(title) ||
|
62
|
-
title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires';
|
63
|
-
}
|
64
|
-
|
65
|
-
function isAllowedName(title) {
|
66
|
-
return isNameParameterRequired(title) || title === 'const' || title === 'constant';
|
67
|
-
}
|
68
|
-
|
69
|
-
function isAllowedNested(title) {
|
70
|
-
return isProperty(title) || isParamTitle(title);
|
71
|
-
}
|
72
|
-
|
73
|
-
function isAllowedOptional(title) {
|
74
|
-
return isProperty(title) || isParamTitle(title);
|
75
|
-
}
|
76
|
-
|
77
|
-
function isTypeParameterRequired(title) {
|
78
|
-
return isParamTitle(title) || isReturnTitle(title) ||
|
79
|
-
title === 'define' || title === 'enum' ||
|
80
|
-
title === 'implements' || title === 'this' ||
|
81
|
-
title === 'type' || title === 'typedef' || isProperty(title);
|
82
|
-
}
|
83
|
-
|
84
|
-
// Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required
|
85
|
-
// This would require changes to 'parseType'
|
86
|
-
function isAllowedType(title) {
|
87
|
-
return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' ||
|
88
|
-
title === 'namespace' || title === 'member' || title === 'var' || title === 'module' ||
|
89
|
-
title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' ||
|
90
|
-
title === 'public' || title === 'private' || title === 'protected';
|
91
|
-
}
|
92
|
-
|
93
|
-
// A regex character class that contains all whitespace except linebreak characters (\r, \n, \u2028, \u2029)
|
94
|
-
var WHITESPACE = '[ \\f\\t\\v\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]';
|
95
|
-
|
96
|
-
var STAR_MATCHER = '(' + WHITESPACE + '*(?:\\*' + WHITESPACE + '?)?)(.+|[\r\n\u2028\u2029])';
|
97
|
-
|
98
|
-
function unwrapComment(doc) {
|
99
|
-
// JSDoc comment is following form
|
100
|
-
// /**
|
101
|
-
// * .......
|
102
|
-
// */
|
103
|
-
|
104
|
-
return doc.
|
105
|
-
// remove /**
|
106
|
-
replace(/^\/\*\*?/, '').
|
107
|
-
// remove */
|
108
|
-
replace(/\*\/$/, '').
|
109
|
-
// remove ' * ' at the beginning of a line
|
110
|
-
replace(new RegExp(STAR_MATCHER, 'g'), '$2').
|
111
|
-
// remove trailing whitespace
|
112
|
-
replace(/\s*$/, '');
|
113
|
-
}
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Converts an index in an "unwrapped" JSDoc comment to the corresponding index in the original "wrapped" version
|
117
|
-
* @param {string} originalSource The original wrapped comment
|
118
|
-
* @param {number} unwrappedIndex The index of a character in the unwrapped string
|
119
|
-
* @returns {number} The index of the corresponding character in the original wrapped string
|
120
|
-
*/
|
121
|
-
function convertUnwrappedCommentIndex(originalSource, unwrappedIndex) {
|
122
|
-
var replacedSource = originalSource.replace(/^\/\*\*?/, '');
|
123
|
-
var numSkippedChars = 0;
|
124
|
-
var matcher = new RegExp(STAR_MATCHER, 'g');
|
125
|
-
var match;
|
126
|
-
|
127
|
-
while ((match = matcher.exec(replacedSource))) {
|
128
|
-
numSkippedChars += match[1].length;
|
129
|
-
|
130
|
-
if (match.index + match[0].length > unwrappedIndex + numSkippedChars) {
|
131
|
-
return unwrappedIndex + numSkippedChars + originalSource.length - replacedSource.length;
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
return originalSource.replace(/\*\/$/, '').replace(/\s*$/, '').length;
|
136
|
-
}
|
137
|
-
|
138
|
-
// JSDoc Tag Parser
|
139
|
-
|
140
|
-
(function (exports) {
|
141
|
-
var Rules,
|
142
|
-
index,
|
143
|
-
lineNumber,
|
144
|
-
length,
|
145
|
-
source,
|
146
|
-
originalSource,
|
147
|
-
recoverable,
|
148
|
-
sloppy,
|
149
|
-
strict;
|
150
|
-
|
151
|
-
function advance() {
|
152
|
-
var ch = source.charCodeAt(index);
|
153
|
-
index += 1;
|
154
|
-
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) {
|
155
|
-
lineNumber += 1;
|
156
|
-
}
|
157
|
-
return String.fromCharCode(ch);
|
158
|
-
}
|
159
|
-
|
160
|
-
function scanTitle() {
|
161
|
-
var title = '';
|
162
|
-
// waste '@'
|
163
|
-
advance();
|
164
|
-
|
165
|
-
while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) {
|
166
|
-
title += advance();
|
167
|
-
}
|
168
|
-
|
169
|
-
return title;
|
170
|
-
}
|
171
|
-
|
172
|
-
function seekContent() {
|
173
|
-
var ch, waiting, last = index;
|
174
|
-
|
175
|
-
waiting = false;
|
176
|
-
while (last < length) {
|
177
|
-
ch = source.charCodeAt(last);
|
178
|
-
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) {
|
179
|
-
waiting = true;
|
180
|
-
} else if (waiting) {
|
181
|
-
if (ch === 0x40 /* '@' */) {
|
182
|
-
break;
|
183
|
-
}
|
184
|
-
if (!esutils.code.isWhiteSpace(ch)) {
|
185
|
-
waiting = false;
|
186
|
-
}
|
187
|
-
}
|
188
|
-
last += 1;
|
189
|
-
}
|
190
|
-
return last;
|
191
|
-
}
|
192
|
-
|
193
|
-
// type expression may have nest brace, such as,
|
194
|
-
// { { ok: string } }
|
195
|
-
//
|
196
|
-
// therefore, scanning type expression with balancing braces.
|
197
|
-
function parseType(title, last, addRange) {
|
198
|
-
var ch, brace, type, startIndex, direct = false;
|
199
|
-
|
200
|
-
|
201
|
-
// search '{'
|
202
|
-
while (index < last) {
|
203
|
-
ch = source.charCodeAt(index);
|
204
|
-
if (esutils.code.isWhiteSpace(ch)) {
|
205
|
-
advance();
|
206
|
-
} else if (ch === 0x7B /* '{' */) {
|
207
|
-
advance();
|
208
|
-
break;
|
209
|
-
} else {
|
210
|
-
// this is direct pattern
|
211
|
-
direct = true;
|
212
|
-
break;
|
213
|
-
}
|
214
|
-
}
|
215
|
-
|
216
|
-
|
217
|
-
if (direct) {
|
218
|
-
return null;
|
219
|
-
}
|
220
|
-
|
221
|
-
// type expression { is found
|
222
|
-
brace = 1;
|
223
|
-
type = '';
|
224
|
-
while (index < last) {
|
225
|
-
ch = source.charCodeAt(index);
|
226
|
-
if (esutils.code.isLineTerminator(ch)) {
|
227
|
-
advance();
|
228
|
-
} else {
|
229
|
-
if (ch === 0x7D /* '}' */) {
|
230
|
-
brace -= 1;
|
231
|
-
if (brace === 0) {
|
232
|
-
advance();
|
233
|
-
break;
|
234
|
-
}
|
235
|
-
} else if (ch === 0x7B /* '{' */) {
|
236
|
-
brace += 1;
|
237
|
-
}
|
238
|
-
if (type === '') {
|
239
|
-
startIndex = index;
|
240
|
-
}
|
241
|
-
type += advance();
|
242
|
-
}
|
243
|
-
}
|
244
|
-
|
245
|
-
if (brace !== 0) {
|
246
|
-
// braces is not balanced
|
247
|
-
return utility.throwError('Braces are not balanced');
|
248
|
-
}
|
249
|
-
|
250
|
-
if (isAllowedOptional(title)) {
|
251
|
-
return typed.parseParamType(type, {startIndex: convertIndex(startIndex), range: addRange});
|
252
|
-
}
|
253
|
-
|
254
|
-
return typed.parseType(type, {startIndex: convertIndex(startIndex), range: addRange});
|
255
|
-
}
|
256
|
-
|
257
|
-
function scanIdentifier(last) {
|
258
|
-
var identifier;
|
259
|
-
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index)) && !source[index].match(/[0-9]/)) {
|
260
|
-
return null;
|
261
|
-
}
|
262
|
-
identifier = advance();
|
263
|
-
while (index < last && esutils.code.isIdentifierPartES5(source.charCodeAt(index))) {
|
264
|
-
identifier += advance();
|
265
|
-
}
|
266
|
-
return identifier;
|
267
|
-
}
|
268
|
-
|
269
|
-
function skipWhiteSpace(last) {
|
270
|
-
while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) {
|
271
|
-
advance();
|
272
|
-
}
|
273
|
-
}
|
274
|
-
|
275
|
-
function parseName(last, allowBrackets, allowNestedParams) {
|
276
|
-
var name = '',
|
277
|
-
useBrackets,
|
278
|
-
insideString;
|
279
|
-
|
280
|
-
|
281
|
-
skipWhiteSpace(last);
|
282
|
-
|
283
|
-
if (index >= last) {
|
284
|
-
return null;
|
285
|
-
}
|
286
|
-
|
287
|
-
if (source.charCodeAt(index) === 0x5B /* '[' */) {
|
288
|
-
if (allowBrackets) {
|
289
|
-
useBrackets = true;
|
290
|
-
name = advance();
|
291
|
-
} else {
|
292
|
-
return null;
|
293
|
-
}
|
294
|
-
}
|
295
|
-
|
296
|
-
name += scanIdentifier(last);
|
297
|
-
|
298
|
-
if (allowNestedParams) {
|
299
|
-
if (source.charCodeAt(index) === 0x3A /* ':' */ && (
|
300
|
-
name === 'module' ||
|
301
|
-
name === 'external' ||
|
302
|
-
name === 'event')) {
|
303
|
-
name += advance();
|
304
|
-
name += scanIdentifier(last);
|
305
|
-
|
306
|
-
}
|
307
|
-
if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){
|
308
|
-
name += advance();
|
309
|
-
name += advance();
|
310
|
-
}
|
311
|
-
while (source.charCodeAt(index) === 0x2E /* '.' */ ||
|
312
|
-
source.charCodeAt(index) === 0x2F /* '/' */ ||
|
313
|
-
source.charCodeAt(index) === 0x23 /* '#' */ ||
|
314
|
-
source.charCodeAt(index) === 0x2D /* '-' */ ||
|
315
|
-
source.charCodeAt(index) === 0x7E /* '~' */) {
|
316
|
-
name += advance();
|
317
|
-
name += scanIdentifier(last);
|
318
|
-
}
|
319
|
-
}
|
320
|
-
|
321
|
-
if (useBrackets) {
|
322
|
-
skipWhiteSpace(last);
|
323
|
-
// do we have a default value for this?
|
324
|
-
if (source.charCodeAt(index) === 0x3D /* '=' */) {
|
325
|
-
// consume the '='' symbol
|
326
|
-
name += advance();
|
327
|
-
skipWhiteSpace(last);
|
328
|
-
|
329
|
-
var ch;
|
330
|
-
var bracketDepth = 1;
|
331
|
-
|
332
|
-
// scan in the default value
|
333
|
-
while (index < last) {
|
334
|
-
ch = source.charCodeAt(index);
|
335
|
-
|
336
|
-
if (esutils.code.isWhiteSpace(ch)) {
|
337
|
-
if (!insideString) {
|
338
|
-
skipWhiteSpace(last);
|
339
|
-
ch = source.charCodeAt(index);
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
if (ch === 0x27 /* ''' */) {
|
344
|
-
if (!insideString) {
|
345
|
-
insideString = '\'';
|
346
|
-
} else {
|
347
|
-
if (insideString === '\'') {
|
348
|
-
insideString = '';
|
349
|
-
}
|
350
|
-
}
|
351
|
-
}
|
352
|
-
|
353
|
-
if (ch === 0x22 /* '"' */) {
|
354
|
-
if (!insideString) {
|
355
|
-
insideString = '"';
|
356
|
-
} else {
|
357
|
-
if (insideString === '"') {
|
358
|
-
insideString = '';
|
359
|
-
}
|
360
|
-
}
|
361
|
-
}
|
362
|
-
|
363
|
-
if (ch === 0x5B /* '[' */) {
|
364
|
-
bracketDepth++;
|
365
|
-
} else if (ch === 0x5D /* ']' */ &&
|
366
|
-
--bracketDepth === 0) {
|
367
|
-
break;
|
368
|
-
}
|
369
|
-
|
370
|
-
name += advance();
|
371
|
-
}
|
372
|
-
}
|
373
|
-
|
374
|
-
skipWhiteSpace(last);
|
375
|
-
|
376
|
-
if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) {
|
377
|
-
// we never found a closing ']'
|
378
|
-
return null;
|
379
|
-
}
|
380
|
-
|
381
|
-
// collect the last ']'
|
382
|
-
name += advance();
|
383
|
-
}
|
384
|
-
|
385
|
-
return name;
|
386
|
-
}
|
387
|
-
|
388
|
-
function skipToTag() {
|
389
|
-
while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) {
|
390
|
-
advance();
|
391
|
-
}
|
392
|
-
if (index >= length) {
|
393
|
-
return false;
|
394
|
-
}
|
395
|
-
utility.assert(source.charCodeAt(index) === 0x40 /* '@' */);
|
396
|
-
return true;
|
397
|
-
}
|
398
|
-
|
399
|
-
function convertIndex(rangeIndex) {
|
400
|
-
if (source === originalSource) {
|
401
|
-
return rangeIndex;
|
402
|
-
}
|
403
|
-
return convertUnwrappedCommentIndex(originalSource, rangeIndex);
|
404
|
-
}
|
405
|
-
|
406
|
-
function TagParser(options, title) {
|
407
|
-
this._options = options;
|
408
|
-
this._title = title.toLowerCase();
|
409
|
-
this._tag = {
|
410
|
-
title: title,
|
411
|
-
description: null
|
412
|
-
};
|
413
|
-
if (this._options.lineNumbers) {
|
414
|
-
this._tag.lineNumber = lineNumber;
|
415
|
-
}
|
416
|
-
this._first = index - title.length - 1;
|
417
|
-
this._last = 0;
|
418
|
-
// space to save special information for title parsers.
|
419
|
-
this._extra = { };
|
420
|
-
}
|
421
|
-
|
422
|
-
// addError(err, ...)
|
423
|
-
TagParser.prototype.addError = function addError(errorText) {
|
424
|
-
var args = Array.prototype.slice.call(arguments, 1),
|
425
|
-
msg = errorText.replace(
|
426
|
-
/%(\d)/g,
|
427
|
-
function (whole, index) {
|
428
|
-
utility.assert(index < args.length, 'Message reference must be in range');
|
429
|
-
return args[index];
|
430
|
-
}
|
431
|
-
);
|
432
|
-
|
433
|
-
if (!this._tag.errors) {
|
434
|
-
this._tag.errors = [];
|
435
|
-
}
|
436
|
-
if (strict) {
|
437
|
-
utility.throwError(msg);
|
438
|
-
}
|
439
|
-
this._tag.errors.push(msg);
|
440
|
-
return recoverable;
|
441
|
-
};
|
442
|
-
|
443
|
-
TagParser.prototype.parseType = function () {
|
444
|
-
// type required titles
|
445
|
-
if (isTypeParameterRequired(this._title)) {
|
446
|
-
try {
|
447
|
-
this._tag.type = parseType(this._title, this._last, this._options.range);
|
448
|
-
if (!this._tag.type) {
|
449
|
-
if (!isParamTitle(this._title) && !isReturnTitle(this._title)) {
|
450
|
-
if (!this.addError('Missing or invalid tag type')) {
|
451
|
-
return false;
|
452
|
-
}
|
453
|
-
}
|
454
|
-
}
|
455
|
-
} catch (error) {
|
456
|
-
this._tag.type = null;
|
457
|
-
if (!this.addError(error.message)) {
|
458
|
-
return false;
|
459
|
-
}
|
460
|
-
}
|
461
|
-
} else if (isAllowedType(this._title)) {
|
462
|
-
// optional types
|
463
|
-
try {
|
464
|
-
this._tag.type = parseType(this._title, this._last, this._options.range);
|
465
|
-
} catch (e) {
|
466
|
-
//For optional types, lets drop the thrown error when we hit the end of the file
|
467
|
-
}
|
468
|
-
}
|
469
|
-
return true;
|
470
|
-
};
|
471
|
-
|
472
|
-
TagParser.prototype._parseNamePath = function (optional) {
|
473
|
-
var name;
|
474
|
-
name = parseName(this._last, sloppy && isAllowedOptional(this._title), true);
|
475
|
-
if (!name) {
|
476
|
-
if (!optional) {
|
477
|
-
if (!this.addError('Missing or invalid tag name')) {
|
478
|
-
return false;
|
479
|
-
}
|
480
|
-
}
|
481
|
-
}
|
482
|
-
this._tag.name = name;
|
483
|
-
return true;
|
484
|
-
};
|
485
|
-
|
486
|
-
TagParser.prototype.parseNamePath = function () {
|
487
|
-
return this._parseNamePath(false);
|
488
|
-
};
|
489
|
-
|
490
|
-
TagParser.prototype.parseNamePathOptional = function () {
|
491
|
-
return this._parseNamePath(true);
|
492
|
-
};
|
493
|
-
|
494
|
-
|
495
|
-
TagParser.prototype.parseName = function () {
|
496
|
-
var assign, name;
|
497
|
-
|
498
|
-
// param, property requires name
|
499
|
-
if (isAllowedName(this._title)) {
|
500
|
-
this._tag.name = parseName(this._last, sloppy && isAllowedOptional(this._title), isAllowedNested(this._title));
|
501
|
-
if (!this._tag.name) {
|
502
|
-
if (!isNameParameterRequired(this._title)) {
|
503
|
-
return true;
|
504
|
-
}
|
505
|
-
|
506
|
-
// it's possible the name has already been parsed but interpreted as a type
|
507
|
-
// it's also possible this is a sloppy declaration, in which case it will be
|
508
|
-
// fixed at the end
|
509
|
-
if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) {
|
510
|
-
this._extra.name = this._tag.type;
|
511
|
-
this._tag.name = this._tag.type.name;
|
512
|
-
this._tag.type = null;
|
513
|
-
} else {
|
514
|
-
if (!this.addError('Missing or invalid tag name')) {
|
515
|
-
return false;
|
516
|
-
}
|
517
|
-
}
|
518
|
-
} else {
|
519
|
-
name = this._tag.name;
|
520
|
-
if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') {
|
521
|
-
// extract the default value if there is one
|
522
|
-
// example: @param {string} [somebody=John Doe] description
|
523
|
-
assign = name.substring(1, name.length - 1).split('=');
|
524
|
-
if (assign.length > 1) {
|
525
|
-
this._tag['default'] = assign.slice(1).join('=');
|
526
|
-
}
|
527
|
-
this._tag.name = assign[0];
|
528
|
-
|
529
|
-
// convert to an optional type
|
530
|
-
if (this._tag.type && this._tag.type.type !== 'OptionalType') {
|
531
|
-
this._tag.type = {
|
532
|
-
type: 'OptionalType',
|
533
|
-
expression: this._tag.type
|
534
|
-
};
|
535
|
-
}
|
536
|
-
}
|
537
|
-
}
|
538
|
-
}
|
539
|
-
|
540
|
-
|
541
|
-
return true;
|
542
|
-
};
|
543
|
-
|
544
|
-
TagParser.prototype.parseDescription = function parseDescription() {
|
545
|
-
var description = sliceSource(source, index, this._last).trim();
|
546
|
-
if (description) {
|
547
|
-
if ((/^-\s+/).test(description)) {
|
548
|
-
description = description.substring(2);
|
549
|
-
}
|
550
|
-
this._tag.description = description;
|
551
|
-
}
|
552
|
-
return true;
|
553
|
-
};
|
554
|
-
|
555
|
-
TagParser.prototype.parseCaption = function parseDescription() {
|
556
|
-
var description = sliceSource(source, index, this._last).trim();
|
557
|
-
var captionStartTag = '<caption>';
|
558
|
-
var captionEndTag = '</caption>';
|
559
|
-
var captionStart = description.indexOf(captionStartTag);
|
560
|
-
var captionEnd = description.indexOf(captionEndTag);
|
561
|
-
if (captionStart >= 0 && captionEnd >= 0) {
|
562
|
-
this._tag.caption = description.substring(
|
563
|
-
captionStart + captionStartTag.length, captionEnd).trim();
|
564
|
-
this._tag.description = description.substring(captionEnd + captionEndTag.length).trim();
|
565
|
-
} else {
|
566
|
-
this._tag.description = description;
|
567
|
-
}
|
568
|
-
return true;
|
569
|
-
};
|
570
|
-
|
571
|
-
TagParser.prototype.parseKind = function parseKind() {
|
572
|
-
var kind, kinds;
|
573
|
-
kinds = {
|
574
|
-
'class': true,
|
575
|
-
'constant': true,
|
576
|
-
'event': true,
|
577
|
-
'external': true,
|
578
|
-
'file': true,
|
579
|
-
'function': true,
|
580
|
-
'member': true,
|
581
|
-
'mixin': true,
|
582
|
-
'module': true,
|
583
|
-
'namespace': true,
|
584
|
-
'typedef': true
|
585
|
-
};
|
586
|
-
kind = sliceSource(source, index, this._last).trim();
|
587
|
-
this._tag.kind = kind;
|
588
|
-
if (!hasOwnProperty(kinds, kind)) {
|
589
|
-
if (!this.addError('Invalid kind name \'%0\'', kind)) {
|
590
|
-
return false;
|
591
|
-
}
|
592
|
-
}
|
593
|
-
return true;
|
594
|
-
};
|
595
|
-
|
596
|
-
TagParser.prototype.parseAccess = function parseAccess() {
|
597
|
-
var access;
|
598
|
-
access = sliceSource(source, index, this._last).trim();
|
599
|
-
this._tag.access = access;
|
600
|
-
if (access !== 'private' && access !== 'protected' && access !== 'public') {
|
601
|
-
if (!this.addError('Invalid access name \'%0\'', access)) {
|
602
|
-
return false;
|
603
|
-
}
|
604
|
-
}
|
605
|
-
return true;
|
606
|
-
};
|
607
|
-
|
608
|
-
TagParser.prototype.parseThis = function parseThis() {
|
609
|
-
// this name may be a name expression (e.g. {foo.bar}),
|
610
|
-
// an union (e.g. {foo.bar|foo.baz}) or a name path (e.g. foo.bar)
|
611
|
-
var value = sliceSource(source, index, this._last).trim();
|
612
|
-
if (value && value.charAt(0) === '{') {
|
613
|
-
var gotType = this.parseType();
|
614
|
-
if (gotType && this._tag.type.type === 'NameExpression' || this._tag.type.type === 'UnionType') {
|
615
|
-
this._tag.name = this._tag.type.name;
|
616
|
-
return true;
|
617
|
-
} else {
|
618
|
-
return this.addError('Invalid name for this');
|
619
|
-
}
|
620
|
-
} else {
|
621
|
-
return this.parseNamePath();
|
622
|
-
}
|
623
|
-
};
|
624
|
-
|
625
|
-
TagParser.prototype.parseVariation = function parseVariation() {
|
626
|
-
var variation, text;
|
627
|
-
text = sliceSource(source, index, this._last).trim();
|
628
|
-
variation = parseFloat(text, 10);
|
629
|
-
this._tag.variation = variation;
|
630
|
-
if (isNaN(variation)) {
|
631
|
-
if (!this.addError('Invalid variation \'%0\'', text)) {
|
632
|
-
return false;
|
633
|
-
}
|
634
|
-
}
|
635
|
-
return true;
|
636
|
-
};
|
637
|
-
|
638
|
-
TagParser.prototype.ensureEnd = function () {
|
639
|
-
var shouldBeEmpty = sliceSource(source, index, this._last).trim();
|
640
|
-
if (shouldBeEmpty) {
|
641
|
-
if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) {
|
642
|
-
return false;
|
643
|
-
}
|
644
|
-
}
|
645
|
-
return true;
|
646
|
-
};
|
647
|
-
|
648
|
-
TagParser.prototype.epilogue = function epilogue() {
|
649
|
-
var description;
|
650
|
-
|
651
|
-
description = this._tag.description;
|
652
|
-
// un-fix potentially sloppy declaration
|
653
|
-
if (isAllowedOptional(this._title) && !this._tag.type && description && description.charAt(0) === '[') {
|
654
|
-
this._tag.type = this._extra.name;
|
655
|
-
if (!this._tag.name) {
|
656
|
-
this._tag.name = undefined;
|
657
|
-
}
|
658
|
-
|
659
|
-
if (!sloppy) {
|
660
|
-
if (!this.addError('Missing or invalid tag name')) {
|
661
|
-
return false;
|
662
|
-
}
|
663
|
-
}
|
664
|
-
}
|
665
|
-
|
666
|
-
return true;
|
667
|
-
};
|
668
|
-
|
669
|
-
Rules = {
|
670
|
-
// http://usejsdoc.org/tags-access.html
|
671
|
-
'access': ['parseAccess'],
|
672
|
-
// http://usejsdoc.org/tags-alias.html
|
673
|
-
'alias': ['parseNamePath', 'ensureEnd'],
|
674
|
-
// http://usejsdoc.org/tags-augments.html
|
675
|
-
'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
676
|
-
// http://usejsdoc.org/tags-constructor.html
|
677
|
-
'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
678
|
-
// Synonym: http://usejsdoc.org/tags-constructor.html
|
679
|
-
'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
680
|
-
// Synonym: http://usejsdoc.org/tags-extends.html
|
681
|
-
'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
682
|
-
// http://usejsdoc.org/tags-example.html
|
683
|
-
'example': ['parseCaption'],
|
684
|
-
// http://usejsdoc.org/tags-deprecated.html
|
685
|
-
'deprecated': ['parseDescription'],
|
686
|
-
// http://usejsdoc.org/tags-global.html
|
687
|
-
'global': ['ensureEnd'],
|
688
|
-
// http://usejsdoc.org/tags-inner.html
|
689
|
-
'inner': ['ensureEnd'],
|
690
|
-
// http://usejsdoc.org/tags-instance.html
|
691
|
-
'instance': ['ensureEnd'],
|
692
|
-
// http://usejsdoc.org/tags-kind.html
|
693
|
-
'kind': ['parseKind'],
|
694
|
-
// http://usejsdoc.org/tags-mixes.html
|
695
|
-
'mixes': ['parseNamePath', 'ensureEnd'],
|
696
|
-
// http://usejsdoc.org/tags-mixin.html
|
697
|
-
'mixin': ['parseNamePathOptional', 'ensureEnd'],
|
698
|
-
// http://usejsdoc.org/tags-member.html
|
699
|
-
'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
700
|
-
// http://usejsdoc.org/tags-method.html
|
701
|
-
'method': ['parseNamePathOptional', 'ensureEnd'],
|
702
|
-
// http://usejsdoc.org/tags-module.html
|
703
|
-
'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
704
|
-
// Synonym: http://usejsdoc.org/tags-method.html
|
705
|
-
'func': ['parseNamePathOptional', 'ensureEnd'],
|
706
|
-
// Synonym: http://usejsdoc.org/tags-method.html
|
707
|
-
'function': ['parseNamePathOptional', 'ensureEnd'],
|
708
|
-
// Synonym: http://usejsdoc.org/tags-member.html
|
709
|
-
'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
710
|
-
// http://usejsdoc.org/tags-name.html
|
711
|
-
'name': ['parseNamePath', 'ensureEnd'],
|
712
|
-
// http://usejsdoc.org/tags-namespace.html
|
713
|
-
'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
714
|
-
// http://usejsdoc.org/tags-private.html
|
715
|
-
'private': ['parseType', 'parseDescription'],
|
716
|
-
// http://usejsdoc.org/tags-protected.html
|
717
|
-
'protected': ['parseType', 'parseDescription'],
|
718
|
-
// http://usejsdoc.org/tags-public.html
|
719
|
-
'public': ['parseType', 'parseDescription'],
|
720
|
-
// http://usejsdoc.org/tags-readonly.html
|
721
|
-
'readonly': ['ensureEnd'],
|
722
|
-
// http://usejsdoc.org/tags-requires.html
|
723
|
-
'requires': ['parseNamePath', 'ensureEnd'],
|
724
|
-
// http://usejsdoc.org/tags-since.html
|
725
|
-
'since': ['parseDescription'],
|
726
|
-
// http://usejsdoc.org/tags-static.html
|
727
|
-
'static': ['ensureEnd'],
|
728
|
-
// http://usejsdoc.org/tags-summary.html
|
729
|
-
'summary': ['parseDescription'],
|
730
|
-
// http://usejsdoc.org/tags-this.html
|
731
|
-
'this': ['parseThis', 'ensureEnd'],
|
732
|
-
// http://usejsdoc.org/tags-todo.html
|
733
|
-
'todo': ['parseDescription'],
|
734
|
-
// http://usejsdoc.org/tags-typedef.html
|
735
|
-
'typedef': ['parseType', 'parseNamePathOptional'],
|
736
|
-
// http://usejsdoc.org/tags-variation.html
|
737
|
-
'variation': ['parseVariation'],
|
738
|
-
// http://usejsdoc.org/tags-version.html
|
739
|
-
'version': ['parseDescription']
|
740
|
-
};
|
741
|
-
|
742
|
-
TagParser.prototype.parse = function parse() {
|
743
|
-
var i, iz, sequences, method;
|
744
|
-
|
745
|
-
|
746
|
-
// empty title
|
747
|
-
if (!this._title) {
|
748
|
-
if (!this.addError('Missing or invalid title')) {
|
749
|
-
return null;
|
750
|
-
}
|
751
|
-
}
|
752
|
-
|
753
|
-
// Seek to content last index.
|
754
|
-
this._last = seekContent(this._title);
|
755
|
-
|
756
|
-
if (this._options.range) {
|
757
|
-
this._tag.range = [this._first, source.slice(0, this._last).replace(/\s*$/, '').length].map(convertIndex);
|
758
|
-
}
|
759
|
-
|
760
|
-
if (hasOwnProperty(Rules, this._title)) {
|
761
|
-
sequences = Rules[this._title];
|
762
|
-
} else {
|
763
|
-
// default sequences
|
764
|
-
sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue'];
|
765
|
-
}
|
766
|
-
|
767
|
-
for (i = 0, iz = sequences.length; i < iz; ++i) {
|
768
|
-
method = sequences[i];
|
769
|
-
if (!this[method]()) {
|
770
|
-
return null;
|
771
|
-
}
|
772
|
-
}
|
773
|
-
|
774
|
-
return this._tag;
|
775
|
-
};
|
776
|
-
|
777
|
-
function parseTag(options) {
|
778
|
-
var title, parser, tag;
|
779
|
-
|
780
|
-
// skip to tag
|
781
|
-
if (!skipToTag()) {
|
782
|
-
return null;
|
783
|
-
}
|
784
|
-
|
785
|
-
// scan title
|
786
|
-
title = scanTitle();
|
787
|
-
|
788
|
-
// construct tag parser
|
789
|
-
parser = new TagParser(options, title);
|
790
|
-
tag = parser.parse();
|
791
|
-
|
792
|
-
// Seek global index to end of this tag.
|
793
|
-
while (index < parser._last) {
|
794
|
-
advance();
|
795
|
-
}
|
796
|
-
|
797
|
-
return tag;
|
798
|
-
}
|
799
|
-
|
800
|
-
//
|
801
|
-
// Parse JSDoc
|
802
|
-
//
|
803
|
-
|
804
|
-
function scanJSDocDescription(preserveWhitespace) {
|
805
|
-
var description = '', ch, atAllowed;
|
806
|
-
|
807
|
-
atAllowed = true;
|
808
|
-
while (index < length) {
|
809
|
-
ch = source.charCodeAt(index);
|
810
|
-
|
811
|
-
if (atAllowed && ch === 0x40 /* '@' */) {
|
812
|
-
break;
|
813
|
-
}
|
814
|
-
|
815
|
-
if (esutils.code.isLineTerminator(ch)) {
|
816
|
-
atAllowed = true;
|
817
|
-
} else if (atAllowed && !esutils.code.isWhiteSpace(ch)) {
|
818
|
-
atAllowed = false;
|
819
|
-
}
|
820
|
-
|
821
|
-
description += advance();
|
822
|
-
}
|
823
|
-
|
824
|
-
return preserveWhitespace ? description : description.trim();
|
825
|
-
}
|
826
|
-
|
827
|
-
function parse(comment, options) {
|
828
|
-
var tags = [], tag, description, interestingTags, i, iz;
|
829
|
-
|
830
|
-
if (options === undefined) {
|
831
|
-
options = {};
|
832
|
-
}
|
833
|
-
|
834
|
-
if (typeof options.unwrap === 'boolean' && options.unwrap) {
|
835
|
-
source = unwrapComment(comment);
|
836
|
-
} else {
|
837
|
-
source = comment;
|
838
|
-
}
|
839
|
-
|
840
|
-
originalSource = comment;
|
841
|
-
|
842
|
-
// array of relevant tags
|
843
|
-
if (options.tags) {
|
844
|
-
if (Array.isArray(options.tags)) {
|
845
|
-
interestingTags = { };
|
846
|
-
for (i = 0, iz = options.tags.length; i < iz; i++) {
|
847
|
-
if (typeof options.tags[i] === 'string') {
|
848
|
-
interestingTags[options.tags[i]] = true;
|
849
|
-
} else {
|
850
|
-
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
851
|
-
}
|
852
|
-
}
|
853
|
-
} else {
|
854
|
-
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
855
|
-
}
|
856
|
-
}
|
857
|
-
|
858
|
-
length = source.length;
|
859
|
-
index = 0;
|
860
|
-
lineNumber = 0;
|
861
|
-
recoverable = options.recoverable;
|
862
|
-
sloppy = options.sloppy;
|
863
|
-
strict = options.strict;
|
864
|
-
|
865
|
-
description = scanJSDocDescription(options.preserveWhitespace);
|
866
|
-
|
867
|
-
while (true) {
|
868
|
-
tag = parseTag(options);
|
869
|
-
if (!tag) {
|
870
|
-
break;
|
871
|
-
}
|
872
|
-
if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) {
|
873
|
-
tags.push(tag);
|
874
|
-
}
|
875
|
-
}
|
876
|
-
|
877
|
-
return {
|
878
|
-
description: description,
|
879
|
-
tags: tags
|
880
|
-
};
|
881
|
-
}
|
882
|
-
exports.parse = parse;
|
883
|
-
}(jsdoc = {}));
|
884
|
-
|
885
|
-
exports.version = utility.VERSION;
|
886
|
-
exports.parse = jsdoc.parse;
|
887
|
-
exports.parseType = typed.parseType;
|
888
|
-
exports.parseParamType = typed.parseParamType;
|
889
|
-
exports.unwrapComment = unwrapComment;
|
890
|
-
exports.Syntax = shallowCopy(typed.Syntax);
|
891
|
-
exports.Error = utility.DoctrineError;
|
892
|
-
exports.type = {
|
893
|
-
Syntax: exports.Syntax,
|
894
|
-
parseType: typed.parseType,
|
895
|
-
parseParamType: typed.parseParamType,
|
896
|
-
stringify: typed.stringify
|
897
|
-
};
|
898
|
-
}());
|
899
|
-
/* vim: set sw=4 ts=4 et tw=80 : */
|