-
Jakob Gruber authored
This CL implements early SyntaxErrors for regular expressions. Early errors are thrown when a malformed pattern is parsed, rather than when the code first runs. We do this by having the JS parser call into the regexp parser when a regexp pattern is found. Regexps are expected to be relatively rare, small, and cheap to parse - that's why we currently accept that the regexp parser does unnecessary work (e.g. creating the AST structures). If needed, we can optimize in the future. Ideas: - Split up the regexp parser to avoid useless work for syntax validation. - Preserve parser results to avoid reparsing later. Bug: v8:896 Change-Id: I3d1ec18c980ba94439576ac3764138552418b85d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3106647 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Patrick Thier <pthier@chromium.org> Cr-Commit-Position: refs/heads/main@{#76502}
a56874d3