From bee6fe7ebce08b85485554a7100ec38699e8421d Mon Sep 17 00:00:00 2001 From: Conduitry Date: Wed, 6 Mar 2019 12:42:40 -0500 Subject: [PATCH] require whitespace after `{@html` (#2154) --- src/parse/state/mustache.ts | 2 ++ .../samples/raw-mustaches-whitespace-error/error.json | 10 ++++++++++ .../raw-mustaches-whitespace-error/input.svelte | 1 + 3 files changed, 13 insertions(+) create mode 100644 test/parser/samples/raw-mustaches-whitespace-error/error.json create mode 100644 test/parser/samples/raw-mustaches-whitespace-error/input.svelte diff --git a/src/parse/state/mustache.ts b/src/parse/state/mustache.ts index 980ec8555a..bdeb8bdede 100644 --- a/src/parse/state/mustache.ts +++ b/src/parse/state/mustache.ts @@ -316,6 +316,8 @@ export default function mustache(parser: Parser) { } } else if (parser.eat('@html')) { // {@html content} tag + parser.requireWhitespace(); + const expression = readExpression(parser); parser.allowWhitespace(); diff --git a/test/parser/samples/raw-mustaches-whitespace-error/error.json b/test/parser/samples/raw-mustaches-whitespace-error/error.json new file mode 100644 index 0000000000..abb9f8ed0f --- /dev/null +++ b/test/parser/samples/raw-mustaches-whitespace-error/error.json @@ -0,0 +1,10 @@ +{ + "code": "missing-whitespace", + "message": "Expected whitespace", + "start": { + "line": 1, + "column": 6, + "character": 6 + }, + "pos": 6 +} diff --git a/test/parser/samples/raw-mustaches-whitespace-error/input.svelte b/test/parser/samples/raw-mustaches-whitespace-error/input.svelte new file mode 100644 index 0000000000..94e75fda09 --- /dev/null +++ b/test/parser/samples/raw-mustaches-whitespace-error/input.svelte @@ -0,0 +1 @@ +{@htmlfoo}