Skip to content

Commit b8bfcd9

Browse files
authored
fix: comma will now always terminate a tag variable (#123)
1 parent b877225 commit b8bfcd9

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"htmljs-parser": patch
3+
---
4+
5+
Comma will now always terminate a tag variable.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
1╭─ <let/x,y=1/>
2+
│ ││ ││ │││╰─ openTagEnd:selfClosed "/>"
3+
│ ││ ││ ││╰─ attrValue.value
4+
│ ││ ││ │╰─ attrValue "=1"
5+
│ ││ ││ ╰─ attrName
6+
│ ││ │╰─ tagVar.value
7+
│ ││ ╰─ tagVar "/x"
8+
│ │╰─ tagName "let"
9+
╰─ ╰─ openTagStart
10+
2╭─ <let/x ,y=1/>
11+
│ ││ ││ │││╰─ openTagEnd:selfClosed "/>"
12+
│ ││ ││ ││╰─ attrValue.value
13+
│ ││ ││ │╰─ attrValue "=1"
14+
│ ││ ││ ╰─ attrName
15+
│ ││ │╰─ tagVar.value
16+
│ ││ ╰─ tagVar "/x"
17+
│ │╰─ tagName "let"
18+
╰─ ╰─ openTagStart
19+
3╭─ <let/x, y=1/>
20+
│ ││ ││ │││╰─ openTagEnd:selfClosed "/>"
21+
│ ││ ││ ││╰─ attrValue.value
22+
│ ││ ││ │╰─ attrValue "=1"
23+
│ ││ ││ ╰─ attrName
24+
│ ││ │╰─ tagVar.value
25+
│ ││ ╰─ tagVar "/x"
26+
│ │╰─ tagName "let"
27+
╰─ ╰─ openTagStart
28+
4╭─ <let/x , y=1/>
29+
│ ││ ││ │││╰─ openTagEnd:selfClosed "/>"
30+
│ ││ ││ ││╰─ attrValue.value
31+
│ ││ ││ │╰─ attrValue "=1"
32+
│ ││ ││ ╰─ attrName
33+
│ ││ │╰─ tagVar.value
34+
│ ││ ╰─ tagVar "/x"
35+
│ │╰─ tagName "let"
36+
╰─ ╰─ openTagStart
37+
5╰─
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<let/x,y=1/>
2+
<let/x ,y=1/>
3+
<let/x, y=1/>
4+
<let/x , y=1/>

src/states/OPEN_TAG.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const CONCISE_TAG_VAR_TERMINATORS = [
3737
CODE.OPEN_PAREN,
3838
CODE.PIPE,
3939
CODE.EQUAL,
40+
CODE.COMMA,
4041
[CODE.COLON, CODE.EQUAL],
4142
];
4243

@@ -45,6 +46,7 @@ const HTML_TAG_VAR_TERMINATORS = [
4546
CODE.OPEN_PAREN,
4647
CODE.PIPE,
4748
CODE.EQUAL,
49+
CODE.COMMA,
4850
[CODE.COLON, CODE.EQUAL],
4951
[CODE.FORWARD_SLASH, CODE.CLOSE_ANGLE_BRACKET],
5052
];

0 commit comments

Comments
 (0)