diff options
Diffstat (limited to 'tools/node_modules/eslint/node_modules/@es-joy/jsdoccomment/node_modules/comment-parser/es6/parser/tokenizers/tag.js')
-rw-r--r-- | tools/node_modules/eslint/node_modules/@es-joy/jsdoccomment/node_modules/comment-parser/es6/parser/tokenizers/tag.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/node_modules/@es-joy/jsdoccomment/node_modules/comment-parser/es6/parser/tokenizers/tag.js b/tools/node_modules/eslint/node_modules/@es-joy/jsdoccomment/node_modules/comment-parser/es6/parser/tokenizers/tag.js new file mode 100644 index 00000000000..4696b00dab0 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@es-joy/jsdoccomment/node_modules/comment-parser/es6/parser/tokenizers/tag.js @@ -0,0 +1,24 @@ +/** + * Splits the `@prefix` from remaining `Spec.lines[].token.descrioption` into the `tag` token, + * and populates `spec.tag` + */ +export default function tagTokenizer() { + return (spec) => { + const { tokens } = spec.source[0]; + const match = tokens.description.match(/\s*(@(\S+))(\s*)/); + if (match === null) { + spec.problems.push({ + code: 'spec:tag:prefix', + message: 'tag should start with "@" symbol', + line: spec.source[0].number, + critical: true, + }); + return spec; + } + tokens.tag = match[1]; + tokens.postTag = match[3]; + tokens.description = tokens.description.slice(match[0].length); + spec.tag = match[2]; + return spec; + }; +} |