为什么这个javascript片段触发“意外令牌非法”
Why is this javascript snippet triggering "Unexpected token ILLEGAL"?
缩小的google-code-prettify javascript lib的一行触发了"意外令牌非法"。如果我删除它,库工作正常。我试图删除特殊的字符,期望编码是代码,但似乎不是。
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^['t'n'r 'xa0'u2028'u2029]+/,null,"'t'n'r Â'xa0

"],["str",/^(?:["'u201c'u201d](?:[^"'u201c'u201d]|["'u201c'u201d]{2})(?:["'u201c'u201d]c|$)|["'u201c'u201d](?:[^"'u201c'u201d]|["'u201c'u201d]{2})*(?:["'u201c'u201d]|$))/i,null,'"“â€'],["com",/^[''u2018'u2019].*/,null,"'‘’"]],[["kwd",/^(?:addhandler|addressof|alias|and|andalso|ansi|as|assembly|auto|boolean|byref|byte|byval|call|case|catch|cbool|cbyte|cchar|cdate|cdbl|cdec|char|cint|class|clng|cobj|const|cshort|csng|cstr|ctype|date|decimal|declare|default|delegate|dim|directcast|do|double|each|else|elseif|end|endif|enum|erase|error|event|exit|finally|for|friend|function|get|gettype|gosub|goto|handles|if|implements|imports|in|inherits|integer|interface|is|let|lib|like|long|loop|me|mod|module|mustinherit|mustoverride|mybase|myclass|namespace|new|next|not|notinheritable|notoverridable|object|on|option|optional|or|orelse|overloads|overridable|overrides|paramarray|preserve|private|property|protected|public|raiseevent|readonly|redim|removehandler|resume|return|select|set|shadows|shared|short|single|static|step|stop|string|structure|sub|synclock|then|throw|to|try|typeof|unicode|until|variant|wend|when|while|with|withevents|writeonly|xor|endif|gosub|let|variant|wend)'b/i,null],["com",/^rem.*/i],["lit",/^(?:true'b|false'b|nothing'b|'d+(?:e[+-]?'d+[dfr]?|[dfilrs])?|(?:&h['da-f]+|&o[0-7]+)[ils]?|'d*'.'d+(?:e[+-]?'d+)?[dfr]?|#'s+(?:'d+[/-]'d+[/-]'d+(?:'s+'d+:'d+(?::'d+)?('s*(?:am|pm))?)?|'d+:'d+(?::'d+)?('s*(?:am|pm))?)'s+#)/i],["pln",/^(?:(?:[a-z]|_'w)'w*|'[(?:[a-z]|_'w)'w*])/i],["pun",/^[^'w't'n'r "'[']'xa0'u2018'u2019'u201c'u201d'u2028'u2029]+/],["pun",/^(?:'[|])/]]),["vb","vbs"]);
我试图将["pun",/^(?:'[|])/]])
更改为["pun",/^(?:'[|])/])
但没有运气。
编辑:
我可以确定"''t'''r â''xa0†̈"©是它的因果关系,但我说不出为什么。
这很可能是一个编码问题,因为从"'t'n'r Â'xa0

"
中删除¨â
可以解决问题。删除 2 个字符中的一个不会。
相关文章:
- React JS:未捕获(在承诺中)语法错误:在位置 0 的 JSON 中意外<令牌
- jQuery$.getJSON抛出意外令牌
- 为什么我在下面的..of循环中得到意外令牌
- 组件中的ReactJS意外令牌
- AngularJS $http GET 请求到本地 JSON 文件返回语法错误:意外令牌]
- 巴别塔,意外令牌 (15:33) ::.
- Sencha 2.0 和 Codeigniter RESTful API 生成未捕获的语法错误:意外令牌:
- 在事件上使用 jquery 时出现意外令牌
- JSON 中位置 4 处的意外令牌<
- 意外令牌 ) 在我的代码中
- Electron 和 Babel 6 异步/等待抛出意外令牌
- “JSON.parse(str)”返回“意外令牌c”,但str是一个字符串
- jQuery after() uncatch SyntaxError: 意外令牌 ILLEGAL
- 使用节点javascript的意外令牌ILLEGAL
- Javascript/JQuery-Chrome意外令牌
- Ajax 帖子未捕获语法错误:意外令牌非法
- angularjs-SyntaxError:请求从服务器返回时出现意外令牌
- jquery:使用ember的意外令牌C
- React本机项目中的意外令牌
- 解析有效的 JSON 得到“语法错误:意外令牌非法”