marko-js / htmljs-parser

An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values
MIT License
135 stars 20 forks source link

fix: issue with parsing division followed by encloused code #138

Closed DylanPiercey closed 1 year ago

DylanPiercey commented 1 year ago

Description

Fixes a parse error where division is immediately followed by enclosed code.

Specifically if an expression looked something like

x / (y[z])

When the parser encountered division it consumed the whitespace and went one character ahead. In the above example that'd cause it to skip over the ( which caused the enclosed expression tracking to be off.

Checklist:

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: a88d06a04e9f6de6b129d37e47bdb2f0c537dbc9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------- | ----- | | htmljs-parser | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

codecov[bot] commented 1 year ago

Codecov Report

Base: 92.13% // Head: 92.13% // No change to project coverage :thumbsup:

Coverage data is based on head (a88d06a) compared to base (6b7373f). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #138 +/- ## ======================================= Coverage 92.13% 92.13% ======================================= Files 26 26 Lines 801 801 Branches 268 268 ======================================= Hits 738 738 Misses 48 48 Partials 15 15 ``` | [Impacted Files](https://codecov.io/gh/marko-js/htmljs-parser/pull/138?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marko-js) | Coverage Δ | | |---|---|---| | [src/states/EXPRESSION.ts](https://codecov.io/gh/marko-js/htmljs-parser/pull/138/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marko-js#diff-c3JjL3N0YXRlcy9FWFBSRVNTSU9OLnRz) | `91.93% <ø> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marko-js). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marko-js)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.