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

Unexpected syntax error when parsing a regexp with backslashes and special characters (new in 1.16.1) #68

Closed
MatmaRex opened this issue Mar 4, 2024 · 2 comments

Comments

@MatmaRex
Copy link

MatmaRex commented Mar 4, 2024

Hi, thank you for building this project, it's very useful!

After upgrading to Peast 1.16.1 to fix the edge case in parsing that @Krinkle reported in #67, we've discovered a new problem. It seems that the regexp parser that wasn't strict enough before is now too strict.

Minimal test case is: Peast\Peast::ES2016( '/=\n/' )->parse(); – this succeeds on 1.16.0 and throws an exception on 1.16.1.

Downstream bug reports for context, and links to the script that triggered the problem in case you need a bigger test case:

Thanks!

@mck89
Copy link
Owner

mck89 commented Mar 5, 2024

I've just fixed this bug and released a new version, actually the problem was only for a regex that started with /= since that is also an operator and the scanner could not detect when it should forgive an invalid character after that to try reconsuming it as regex.
Thank you for reporting!

@mck89 mck89 closed this as completed Mar 5, 2024
@MatmaRex
Copy link
Author

MatmaRex commented Mar 5, 2024

Thank you!

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

No branches or pull requests

2 participants