Correctly tokenize quotation marks within single token

This commit is contained in:
Joonas Mertanen
2019-08-08 08:08:18 -05:00
committed by Jun Yang
parent af841dc872
commit 9956c53b09
+6 -1
View File
@@ -69,7 +69,12 @@ export default class Value {
tokens.push(str[i++])
} else {
const j = i++
for (; i < str.length && !/[|,:\s]/.test(str[i]); ++i);
let ch
for (; i < str.length && !/[|,:\s]/.test(ch = str[i]); ++i) {
if (ch === '"' || ch === "'") {
for (i += 2; i < str.length && str[i - 1] !== ch; ++i);
}
}
tokens.push(str.slice(j, i))
}
}