Skip to content

Commit 9818025

Browse files
committed
Fix issue caused by pretokenising of UTF8 strings (which get converted after the pretokenise step and cause the length to be wrong)
Even if length were correct, pretokenising the string stops the scan for UTF8 char patterns so the string wouldn't be treated correctly
1 parent b84588b commit 9818025

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/pretokenise.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@
196196
resultCode += "\n";
197197
if (tok.str==")" || tok.str=="}" || tok.str=="]") brackets--;
198198
// if we have a token for something, use that - else use the string
199-
if (pretokeniseStrings && tok.type == "STRING") {
199+
if (pretokeniseStrings && tok.type == "STRING" &&
200+
tok.value.split("").reduce((r,ch) => r&&(ch.charCodeAt(0)<256), true)/*all 8 bit*/) {
200201
let str = tok.value; // get string value
201202
lastIdx = tok.endIdx; // get next token
202203
lastlastTok = lastTok;

0 commit comments

Comments
 (0)