Skip to content

Continue parsing unterminated regexes #18294

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

Closed
wants to merge 3 commits into from

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Sep 6, 2017

Sometimes we incorrectly recognise slash token as the start of an unterminated regex literal, and this allows those cases to produce a correct parse. It would be better for the parser to correctly parse slash tokens instead, because this way adds bogus parse errors for unterminated regex literals.

This was introduced back in 2014 in 886feda and 7dd30d3, having to with simplifying how regexes are incrementally parsed. Looking at that change may show how to correctly classify slash tokens.

Fixes #18158
Fixes #18306

Edit: unterminated regex literal, not string literal.

Sometimes we incorrectly recognise slash token as the start of an
unterminated string literal, and this allows those cases to produce a
correct parse.

It would be better for the parser to correctly parse slash token
instead, because this way adds bogus parse errors for unterminated regex
literals.
@sandersn
Copy link
Member Author

sandersn commented Sep 6, 2017

A fourslash test failed. I'll update it.

@sandersn
Copy link
Member Author

#18417 is a better fix than this, and this PR should be closed if it is merged.

@sandersn sandersn closed this Sep 19, 2017
@sandersn sandersn deleted the continue-parsing-unterminated-regexes branch September 19, 2017 18:14
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants