From 19ac8e224a092ad7ead7ad171edc8f9c79880b03 Mon Sep 17 00:00:00 2001 From: Dylan Piercey Date: Wed, 4 May 2022 13:33:21 -0700 Subject: [PATCH] feat: tag var type is continuable expression --- .changeset/fluffy-emus-try.md | 5 ++ .../tag-var-declaration.expected.txt | 74 +++++++++++++------ .../fixtures/tag-var-declaration/input.marko | 7 ++ src/states/EXPRESSION.ts | 5 +- src/states/OPEN_TAG.ts | 10 ++- 5 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 .changeset/fluffy-emus-try.md diff --git a/.changeset/fluffy-emus-try.md b/.changeset/fluffy-emus-try.md new file mode 100644 index 00000000..43ccc6c0 --- /dev/null +++ b/.changeset/fluffy-emus-try.md @@ -0,0 +1,5 @@ +--- +"htmljs-parser": patch +--- + +Parse tag variable type as an continuable expression. diff --git a/src/__tests__/fixtures/tag-var-declaration/__snapshots__/tag-var-declaration.expected.txt b/src/__tests__/fixtures/tag-var-declaration/__snapshots__/tag-var-declaration.expected.txt index b8e9b621..19ebb1ac 100644 --- a/src/__tests__/fixtures/tag-var-declaration/__snapshots__/tag-var-declaration.expected.txt +++ b/src/__tests__/fixtures/tag-var-declaration/__snapshots__/tag-var-declaration.expected.txt @@ -33,51 +33,81 @@ │ │ ╰─ tagVar "/foo" ╰─ ╰─ tagName "let" 7╭─ - │ │ ││ │ │╰─ openTagEnd:selfClosed "/>" - │ │ ││ │ ╰─ attrName - │ │ ││ ╰─ attrName - │ │ │╰─ tagVar.value "foo" - │ │ ╰─ tagVar "/foo" + │ │ ││ ╰─ openTagEnd:selfClosed "/>" + │ │ │╰─ tagVar.value "foo + 1" + │ │ ╰─ tagVar "/foo + 1" ╰─ ╰─ tagName "let" -8╭─ - │ │ ││ ╰─ openTagEnd:selfClosed "/>" - │ │ │╰─ tagVar.value "{ x, y }" - │ │ ╰─ tagVar "/{ x, y }" +8╭─ + │ │ ││ ╰─ openTagEnd:selfClosed "/>" + │ │ │╰─ tagVar.value "foo:string" + │ │ ╰─ tagVar "/foo:string" ╰─ ╰─ tagName "let" -9├─ -10╭─