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 multiple escape parsing issues #76

Merged
merged 1 commit into from
Jan 7, 2024
Merged

Fix multiple escape parsing issues #76

merged 1 commit into from
Jan 7, 2024

Conversation

raskad
Copy link
Collaborator

@raskad raskad commented Dec 28, 2023

This PR works on the escape parsing.

The PR changes the following:

  • Fix a missing flag check where unicode property escapes would be parsed in non-unicode mode.
    • Add the unicode flag to some tests because of the above fix.
  • Remove the unused Parser.max_backref field.
  • Move the Term :: Assertion :: \b and Term :: Assertion :: \B parsing from atom escape parsing to term parsing.
  • Add parsing for the case Term :: ExtendedAtom :: \ [lookahead = c].
  • Add parsing for the case ClassEscape :: [~UnicodeMode] c ClassControlLetter.
  • Add parsing for CharacterEscape :: [~UnicodeMode] LegacyOctalEscapeSequence.
  • Fix errors thrown when CharacterEscape :: 0 [lookahead ∉ DecimalDigit], CharacterEscape :: HexEscapeSequence :: x HexDigit HexDigit or CharacterEscape :: RegExpUnicodeEscapeSequence where parsed unsuccessfully but IdentityEscape is still valid.
  • Fix errors thrown when DecimalEscape parsed unsuccessfully but CharacterEscape os still valid.

These changes fix the following 262 tests:

test/language/literals/regexp/u-invalid-identity-escape.js
test/language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js
test/annexB/language/literals/regexp/identity-escape.js
test/annexB/language/literals/regexp/legacy-octal-escape.js
test/annexB/language/literals/regexp/class-escape.js
test/annexB/built-ins/RegExp/incomplete_hex_unicode_escape.js
test/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js
test/annexB/built-ins/RegExp/RegExp-trailing-escape.js
test/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js
test/annexB/built-ins/RegExp/RegExp-leading-escape.js
test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js

@ridiculousfish
Copy link
Owner

Thank you! Gonna trust you on faithfully implementing the spec - I didn't check it, I'm not sure how to even read the latest editions 😬

@raskad raskad merged commit 5abeee3 into master Jan 7, 2024
7 checks passed
@raskad raskad deleted the escape-parsing branch January 7, 2024 08:48
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.

2 participants