2012-04-28 93 views
0

縮小的一行google-code-prettify javascript lib觸發「Unexpected token ILLEGAL」。如果我刪除它的lib工作正常。我試圖刪除特殊字符,期望編碼是代碼,但它似乎不是。爲什麼這個javascript代碼片段觸發「Unexpected token ILLEGAL」?

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 \ n \ r A \xa0â€一個€©」 是causin,但我不知道爲什麼。

+0

你搞砸了編碼? 「\ t \ n \ r \xa0â」看起來像無意識的mojibake。 – Andrea 2012-04-28 12:44:48

+0

我也覺得。我從頭到尾使用UTF8,並且Google代碼上的文件似乎按照AS-IS使用。所以,因爲這是一個VB插件,懷疑它已被保存在ISO下的窗口下。 – 2012-04-28 12:55:54

回答

0

這可能是一個編碼問題,因爲從"\t\n\r Â\xa0

"中刪除¨â可以解決問題。刪除2個字符中的一個不會。

相關問題