From 9956c53b09fdccd7795f1e7cda3c9f85eed2def4 Mon Sep 17 00:00:00 2001 From: Joonas Mertanen Date: Thu, 8 Aug 2019 15:08:09 +0300 Subject: [PATCH] Correctly tokenize quotation marks within single token --- src/template/value.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/template/value.ts b/src/template/value.ts index ff02dcbd7..2353ec16d 100644 --- a/src/template/value.ts +++ b/src/template/value.ts @@ -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)) } }