-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid regexp for expression continuations (#130)
* refactor: avoid regexp parsing for expression continuations
- Loading branch information
1 parent
250c17b
commit ebc850f
Showing
28 changed files
with
817 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"htmljs-parser": patch | ||
--- | ||
|
||
Switch from regexp based parsing for the expression continuations. This slightly improves performance and more importantly fixes usage of the parser in safari. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
tag a = function (x) { console.log("y") } b | ||
tag a = (x) => { console.log("y") } b | ||
tag a = x => { console.log("y") } b | ||
tag a = x => y b | ||
tag a = x => y + 1 b | ||
tag a = x => y = 1 b | ||
tag a = async x => { console.log("y") } b | ||
tag a = async function (x) { console.log("y") } b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/__tests__/fixtures/attr-concise-hyphens/__snapshots__/attr-concise-hyphens.expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
1╭─ a b=c -- y | ||
│ │ │││ │ ╰─ text | ||
│ │ │││ ╰─ openTagEnd | ||
│ │ ││╰─ attrValue.value | ||
│ │ │╰─ attrValue "=c" | ||
│ │ ╰─ attrName | ||
╰─ ╰─ tagName | ||
2├─ | ||
3╭─ a [b=c -- y] | ||
│ │ │││ ╰─ attrName | ||
│ │ ││╰─ attrValue.value "c --" | ||
│ │ │╰─ attrValue "=c --" | ||
│ │ ╰─ attrName | ||
│ ├─ closeTagEnd(a) | ||
╰─ ╰─ tagName | ||
4╭─ | ||
│ ├─ openTagEnd | ||
╰─ ╰─ closeTagEnd(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a b=c -- y | ||
|
||
a [b=c -- y] |
9 changes: 9 additions & 0 deletions
9
...ures/attr-operator-whitespace-eof/__snapshots__/attr-operator-whitespace-eof.expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
1╭─ tag a = 'foo' instanceof | ||
│ │ │ │ │ ╰─ attrName "instanceof" | ||
│ │ │ │ ╰─ attrValue.value "'foo'" | ||
│ │ │ ╰─ attrValue "= 'foo'" | ||
│ │ ╰─ attrName | ||
╰─ ╰─ tagName "tag" | ||
2╭─ | ||
│ ├─ openTagEnd | ||
╰─ ╰─ closeTagEnd(tag) |
1 change: 1 addition & 0 deletions
1
src/__tests__/fixtures/attr-operator-whitespace-eof/input.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tag a = 'foo' instanceof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.