Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bracket mismatch issue #108

Merged
merged 1 commit into from
May 23, 2022

Conversation

DylanPiercey
Copy link
Contributor

Description

For some parser states we expect them to start on the character which they will process. In those cases it typically does a rewind just before entering the state. However a rewind will not work if the parser was already not going to go forward (eg exited a state).

This PR fixes the issue by changing all cases where we rewind to satisfy this to instead force the parser not to go forward.
This fixes an issue where sometime the parser would incorrectly see mismatched brackets.

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@changeset-bot
Copy link

changeset-bot bot commented May 23, 2022

🦋 Changeset detected

Latest commit: ea29190

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
Copy link

codecov bot commented May 23, 2022

Codecov Report

Merging #108 (ea29190) into main (2bab580) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   94.47%   94.46%   -0.01%     
==========================================
  Files          26       26              
  Lines        1067     1066       -1     
  Branches      255      255              
==========================================
- Hits         1008     1007       -1     
  Misses         39       39              
  Partials       20       20              
Impacted Files Coverage Δ
src/states/ATTRIBUTE.ts 95.74% <100.00%> (ø)
src/states/BEGIN_DELIMITED_HTML_BLOCK.ts 97.56% <100.00%> (ø)
src/states/CONCISE_HTML_CONTENT.ts 92.06% <100.00%> (ø)
src/states/INLINE_SCRIPT.ts 100.00% <100.00%> (ø)
src/states/OPEN_TAG.ts 95.83% <100.00%> (ø)
src/states/PLACEHOLDER.ts 97.56% <100.00%> (ø)
src/states/TAG_NAME.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bab580...ea29190. Read the comment docs.

@DylanPiercey DylanPiercey merged commit 8a988f4 into main May 23, 2022
@DylanPiercey DylanPiercey deleted the fix-sometimes-consuming-additional-chars branch May 23, 2022 21:41
@github-actions github-actions bot mentioned this pull request May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant