WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
206988
Quantifiers after lookahead assertions should be syntax errors in Unicode patterns only
https://bugs.webkit.org/show_bug.cgi?id=206988
Summary
Quantifiers after lookahead assertions should be syntax errors in Unicode pat...
Alexey Shvayka
Reported
2020-01-30 01:27:35 PST
Test case: /(?!.)+/u Expected: SyntaxError thrown Actual: RegExp instance ECMA262:
https://tc39.es/ecma262/#prod-annexB-Term
(/u flag precludes the use of QuantifiableAssertion) Term[U, N] :: [~U] QuantifiableAssertion[?N] Quantifier Assertion[U, N] :: [~U] QuantifiableAssertion[?N] QuantifiableAssertion[N] :: (?= Disjunction[~U, ?N]) (?! Disjunction[~U, ?N]) Test262:
https://test262.report/browse/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js
https://test262.report/browse/language/literals/regexp/u-invalid-range-lookahead.js
https://test262.report/browse/language/literals/regexp/u-invalid-optional-negative-lookahead.js
Attachments
Patch
(7.19 KB, patch)
2020-01-30 01:53 PST
,
Alexey Shvayka
no flags
Details
Formatted Diff
Diff
Patch
(7.21 KB, patch)
2020-01-30 17:28 PST
,
Alexey Shvayka
no flags
Details
Formatted Diff
Diff
Patch
(7.41 KB, patch)
2020-01-31 18:48 PST
,
Alexey Shvayka
no flags
Details
Formatted Diff
Diff
Patch
(7.40 KB, patch)
2020-02-04 09:45 PST
,
Alexey Shvayka
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Shvayka
Comment 1
2020-01-30 01:53:26 PST
Created
attachment 389236
[details]
Patch
Alexey Shvayka
Comment 2
2020-01-30 17:28:33 PST
Created
attachment 389312
[details]
Patch Rename bug in ChangeLog.
Darin Adler
Comment 3
2020-01-31 09:05:45 PST
Comment on
attachment 389312
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=389312&action=review
> Source/JavaScriptCore/yarr/YarrParser.h:709 > + auto parensType = m_parenthesesStack.takeLast(); > + return parensType == ParenthesesType::Subpattern || !m_isUnicode;
In WebKit coding style we normally don’t abbreviate a word like parentheses even in a local variable name. I think calling this just "type" is fine.
> Source/JavaScriptCore/yarr/YarrParser.h:1124 > + enum ParenthesesType { Subpattern, Assertion };
Might get a slightly more efficient code if this was an enum class based on bool or uint8_t.
> Source/JavaScriptCore/yarr/YarrParser.h:1133 > + Vector<ParenthesesType, 16> m_parenthesesStack;
Thisis likely going to be a bit inefficient; we could possibly get a more efficient implementation of a bit vector.
Darin Adler
Comment 4
2020-01-31 12:36:50 PST
I didn’t set the commit queue flag yet because I think the change to enum class might be worth doing before landing. If not, add a comment some committer can add commit-queue+.
Alexey Shvayka
Comment 5
2020-01-31 18:48:44 PST
Created
attachment 389448
[details]
Patch Set reviewer, rename vars, and use std::vector with typed enum class.
Alexey Shvayka
Comment 6
2020-02-01 06:20:25 PST
(In reply to Darin Adler from
comment #3
) >
> Thisis likely going to be a bit inefficient; we could possibly get a more > efficient implementation of a bit vector.
I did some isolated profiling of std::vector<bool>: it allocates 8x less memory, but it performs ~30% slower on push_back() + pop_back() and is not compatible with `enum class`.
Ross Kirsling
Comment 7
2020-02-04 09:32:18 PST
Comment on
attachment 389448
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=389448&action=review
> Source/JavaScriptCore/yarr/YarrParser.h:1141 > + std::vector<ParenthesesType> m_parenthesesStack;
Regardless of the enum class type, we should still use a WTF::Vector.
Alexey Shvayka
Comment 8
2020-02-04 09:45:31 PST
Created
attachment 389671
[details]
Patch Replace std::vector with WTF::Vector.
WebKit Commit Bot
Comment 9
2020-02-04 11:45:26 PST
Comment on
attachment 389671
[details]
Patch Clearing flags on attachment: 389671 Committed
r255689
: <
https://trac.webkit.org/changeset/255689
>
WebKit Commit Bot
Comment 10
2020-02-04 11:45:28 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11
2020-02-04 11:46:17 PST
<
rdar://problem/59157737
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug