0

我运行以下命令:

node_modules/.bin/jsdoc -r --destination /home/user/public_html/jsdoc-meta/ node_modules/jsdoc/

这就是我得到的。我在正则表达式中找不到错误:

/home/user/node_modules/jsdoc/lib/jsdoc/name.js:77
    var regexp = new RegExp('^' + memberof.toString() + REGEXP_SCOPE_PUNC);
                 ^
SyntaxError: Invalid regular expression: /^harmonyTestFixture.ES6 Template Strings.`\u{000042}\u0042\x42\u0\102\A`[~,#,.]/: Unterminated character class
    at new RegExp (<anonymous>)
    at nameIsLongname (/home/user/node_modules/jsdoc/lib/jsdoc/name.js:77:18)
    at Object.exports.resolve (/home/user/node_modules/jsdoc/lib/jsdoc/name.js:114:21)
    at Doclet.postProcess (/home/user/node_modules/jsdoc/lib/jsdoc/doclet.js:171:20)
    at newSymbolDoclet (/home/user/node_modules/jsdoc/lib/jsdoc/src/handlers.js:190:23)
    at null.<anonymous> (/home/user/node_modules/jsdoc/lib/jsdoc/src/handlers.js:226:29)
    at EventEmitter.emit (events.js:98:17)
    at Visitor.visitNode (/home/user/node_modules/jsdoc/lib/jsdoc/src/visitor.js:283:16)
    at Visitor.visit (/home/user/node_modules/jsdoc/lib/jsdoc/src/visitor.js:177:27)
    at Walker.recurse (/home/user/node_modules/jsdoc/lib/jsdoc/src/walker.js:533:27)
4

1 回答 1

1

Node(或者更确切地说是 V8)尝试将其解析为 UTF8 转义序列:

/^harmonyTestFixture.ES6 Template Strings.`\u{000042}\u0042\x42\u0\102\A`[~,#,.]/
                                                                ^^^^^^

但是,由于 the\u0和 the之间的反斜杠102缺少字符,因此出现错误消息 ( Unterminated character class)。根据您要实现的目标,您可以删除该反斜杠:

/^harmonyTestFixture.ES6 Template Strings.`\u{000042}\u0042\x42\u0102\A`[~,#,.]/
                                                                  ^

或转义反斜杠:

/^harmonyTestFixture.ES6 Template Strings.`\u\{000042\}\u0042\x42\u0\\102\A`[~,#,.]/
                                                                    ^^
于 2014-07-22T20:52:58.043 回答