-
Notifications
You must be signed in to change notification settings - Fork 9
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
Disallow irregular patterns #15
Comments
It'd be ideal if we didn't have to use |
@ljharb Nah, I meant that |
ah, ok awesome - throws for programmer input are awesome :-) |
So throw on errors in literal sections per early errors but should never throw because of an interpolated value? |
Well, it wouldn't be exactly a compile-time early error (like they are possible for regex literals), as
OT, but a strict "never" is not possible of course. We will always need to throw in cases like
To precise: |
Fair enough. So constructs that are problematic from regexp_match_web_reality:
Not on that list, but patterns that could indicate a disconnect between author and interpreter:
|
Oh, there's already a list of them? Yeah, it would be nice if we could deprecate them right from the beginning :-) I think we will need to allow those patterns like |
Agreed on To summarize: We should fail on interpolations in some contexts.
Re lookbehind, should we dissallow interplations in
where the valence of the interpolation has not yet been specified. What about in charsets on either side of a
|
The current regex grammar is quite liberal about
SyntaxCharacter
s that appear in places where they are not allowed. For example,/a{/
is just taken literally.This complicates parsing, and deciding what context we are in to escape the interpolation value. As an example, what would
RegExp.make
a{${"1,}b"}do, is it equivalent to
/a{1,}b/`?We should ensure that only well-formed patterns (where interpolation "holes" can produce
Atom
s,DecimalDigits
etc) are allowed as arguments tomake
, and everything else throw aSyntaxError
.The text was updated successfully, but these errors were encountered: