[webkit-changes] [WebKit/WebKit] 30c8a2: [JSC] Add more tests for RegExp V flag and fix iss...
Michael Saboff
noreply at github.com
Wed Mar 15 14:37:17 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 30c8a2c9c4a8874d97236588a3241ca247e8fe36
https://github.com/WebKit/WebKit/commit/30c8a2c9c4a8874d97236588a3241ca247e8fe36
Author: Michael Saboff <msaboff at apple.com>
Date: 2023-03-15 (Wed, 15 Mar 2023)
Changed paths:
M JSTests/stress/regexp-vflag-property-of-strings.js
M Source/JavaScriptCore/yarr/YarrErrorCode.cpp
M Source/JavaScriptCore/yarr/YarrErrorCode.h
M Source/JavaScriptCore/yarr/YarrParser.h
M Source/JavaScriptCore/yarr/YarrPattern.cpp
Log Message:
-----------
[JSC] Add more tests for RegExp V flag and fix issues found
https://bugs.webkit.org/show_bug.cgi?id=253915
rdar://106724836
Reviewed by Yusuke Suzuki.
Added over 40 tests for RegExp V flag, organizing the syntax error tests ahead of the operational tests.
This change doesn't impact the results of the test262 RegExp V flag related tests. Rather it fills in
the missing syntax checks from test262.
Almost all of the issues found with these new tests impact the ClassSetParserDelegate processing.
These changes include:
* Saving and restoring the current parsing state when nesting class sets. That change allowed
eliminating the nesting class level and using the size of the nested parse state vector.
* Implicitly change the opcode type from Default to Union when we have a construct that is only
allowed for the ClassUnion production. For example, a simple unnested rangecl like a-z cannot appear
as part of a ClassIntersection or ClassSubtraction production. This is done with the new method
switchFromDefaultOpToUnionOpIfNeeded().
* Added explicit state handling for set operands. This facilitates the proper processing of
ClassSetOperands per the spec.
* Added syntax checking for the ClassSetSyntaxCharacter and ClassSetReservedPunctuator rules
according to the spec.
* Renamed the CharacterClassConstructionState enum in ClassSetParserDelegate to ClassSetConstructionState.
* Renamed doneAfterCharacterClassEnd() to nestedClassEnd() to match nestedClassBegin().
Since the return value of parseClassSetEscape() wasn't used, changed the type to void.
Updated CharacterClassConstructor::putChar(UChar32) with a new helper to handle adding characters
as part of the right hand side of a intersection or subtraction set operation.
Added a new error, InvalidClassSetCharacter, and changed the spelling of all the errors added with the
RegExp V flag initial checkin to have an initial lower case letter like all the other RegExp error strings.
* JSTests/stress/regexp-vflag-property-of-strings.js:
(testRegExpSyntaxError):
* Source/JavaScriptCore/yarr/YarrErrorCode.cpp:
(JSC::Yarr::errorMessage):
(JSC::Yarr::errorToThrow):
* Source/JavaScriptCore/yarr/YarrErrorCode.h:
* Source/JavaScriptCore/yarr/YarrParser.h:
(JSC::Yarr::Parser::ClassSetParserDelegate::NestingState::NestingState):
(JSC::Yarr::Parser::ClassSetParserDelegate::ClassSetParserDelegate):
(JSC::Yarr::Parser::ClassSetParserDelegate::nestedClassBegin):
(JSC::Yarr::Parser::ClassSetParserDelegate::nestedClassEnd):
(JSC::Yarr::Parser::ClassSetParserDelegate::switchFromDefaultOpToUnionOpIfNeeded):
(JSC::Yarr::Parser::ClassSetParserDelegate::setSubtractOp):
(JSC::Yarr::Parser::ClassSetParserDelegate::setIntersectionOp):
(JSC::Yarr::Parser::ClassSetParserDelegate::flushCachedCharacterIfNeeded):
(JSC::Yarr::Parser::ClassSetParserDelegate::afterOperand):
(JSC::Yarr::Parser::ClassSetParserDelegate::canTakeSetOperand):
(JSC::Yarr::Parser::ClassSetParserDelegate::setProcessingEscape):
(JSC::Yarr::Parser::ClassSetParserDelegate::atomPatternCharacter):
(JSC::Yarr::Parser::ClassSetParserDelegate::atomBuiltInCharacterClass):
(JSC::Yarr::Parser::ClassSetParserDelegate::end):
(JSC::Yarr::Parser::isIdentityEscapeAnError):
(JSC::Yarr::Parser::parseClassSetEscape):
(JSC::Yarr::Parser::parseClassSet):
(JSC::Yarr::Parser::ClassSetParserDelegate::doneAfterCharacterClassEnd): Deleted.
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::CharacterClassConstructor::putChar):
(JSC::Yarr::CharacterClassConstructor::putCharNonUnion):
(JSC::Yarr::CharacterClassConstructor::isUnionSetOp):
Canonical link: https://commits.webkit.org/261714@main
More information about the webkit-changes
mailing list