haikuwebkit/LayoutTests/js/regexp-sticky-expected.txt

47 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

[ES6] Implement RegExp sticky flag and related functionality https://bugs.webkit.org/show_bug.cgi?id=155177 Reviewed by Saam Barati. Source/JavaScriptCore: Implemented the ES6 RegExp sticky functionality. There are two main behavior changes when the sticky flag is specified. 1) Matching starts at lastIndex and lastIndex is updated after the match. 2) The regular expression is only matched from the start position in the string. See ES6 section 21.2.5.2.2 for details. Changed both the Yarr interpreter and jit to not loop to the next character for sticky RegExp's. Updated RegExp exec and match, and stringProtoFuncMatch to handle lastIndex changes. Restructured the way flags are passed to and through YarrPatterns to use RegExpFlags instead of individual bools. Updated tests for 'y' flag and new behavior. * bytecode/CodeBlock.cpp: (JSC::regexpToSourceString): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * runtime/CommonIdentifiers.h: * runtime/RegExp.cpp: (JSC::regExpFlags): (JSC::RegExpFunctionalTestCollector::outputOneTest): (JSC::RegExp::finishCreation): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * runtime/RegExpKey.h: * runtime/RegExpObjectInlines.h: (JSC::RegExpObject::execInline): (JSC::RegExpObject::matchInline): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::flagsString): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncMatch): * tests/es6.yaml: * tests/stress/static-getter-in-names.js: (shouldBe): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::matchAssertionBOL): (JSC::Yarr::Interpreter::matchAssertionEOL): (JSC::Yarr::Interpreter::matchAssertionWordBoundary): (JSC::Yarr::Interpreter::matchDotStarEnclosure): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::atomPatternCharacter): * yarr/YarrInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): (JSC::Yarr::BytecodePattern::estimatedSizeInBytes): (JSC::Yarr::BytecodePattern::ignoreCase): (JSC::Yarr::BytecodePattern::multiline): (JSC::Yarr::BytecodePattern::sticky): (JSC::Yarr::BytecodePattern::unicode): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::matchCharacterClass): (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals): (JSC::Yarr::YarrGenerator::generateAssertionBOL): (JSC::Yarr::YarrGenerator::generateAssertionEOL): (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generateDotStarEnclosure): (JSC::Yarr::YarrGenerator::backtrack): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter): (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::YarrPatternConstructor::optimizeBOL): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::reset): (JSC::Yarr::YarrPattern::nonwordcharCharacterClass): (JSC::Yarr::YarrPattern::ignoreCase): (JSC::Yarr::YarrPattern::multiline): (JSC::Yarr::YarrPattern::sticky): (JSC::Yarr::YarrPattern::unicode): LayoutTests: New and updated tests. * js/Object-getOwnPropertyNames-expected.txt: * js/regexp-flags-expected.txt: * js/regexp-sticky-expected.txt: Added. * js/regexp-sticky.html: Added. * js/script-tests/Object-getOwnPropertyNames.js: * js/script-tests/regexp-flags.js: (RegExp.prototype.hasOwnProperty): Deleted check for sticky property. * js/script-tests/regexp-sticky.js: New test. (asString): (testStickyExec): (testStickyMatch): Canonical link: https://commits.webkit.org/173344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-09 20:11:46 +00:00
Test for ES6 sticky flag regular expression processing
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Repeating Pattern
PASS Test lastIndex resets
PASS Ignore Case
PASS Alternates, differing lengths long to short
PASS Alternates, differing lengths long to short with mutliple matches
PASS Alternates, differing lengths, short to long
[ES6] Implement RegExp sticky flag and related functionality https://bugs.webkit.org/show_bug.cgi?id=155177 Reviewed by Saam Barati. Source/JavaScriptCore: Implemented the ES6 RegExp sticky functionality. There are two main behavior changes when the sticky flag is specified. 1) Matching starts at lastIndex and lastIndex is updated after the match. 2) The regular expression is only matched from the start position in the string. See ES6 section 21.2.5.2.2 for details. Changed both the Yarr interpreter and jit to not loop to the next character for sticky RegExp's. Updated RegExp exec and match, and stringProtoFuncMatch to handle lastIndex changes. Restructured the way flags are passed to and through YarrPatterns to use RegExpFlags instead of individual bools. Updated tests for 'y' flag and new behavior. * bytecode/CodeBlock.cpp: (JSC::regexpToSourceString): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * runtime/CommonIdentifiers.h: * runtime/RegExp.cpp: (JSC::regExpFlags): (JSC::RegExpFunctionalTestCollector::outputOneTest): (JSC::RegExp::finishCreation): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * runtime/RegExpKey.h: * runtime/RegExpObjectInlines.h: (JSC::RegExpObject::execInline): (JSC::RegExpObject::matchInline): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::flagsString): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncMatch): * tests/es6.yaml: * tests/stress/static-getter-in-names.js: (shouldBe): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::matchAssertionBOL): (JSC::Yarr::Interpreter::matchAssertionEOL): (JSC::Yarr::Interpreter::matchAssertionWordBoundary): (JSC::Yarr::Interpreter::matchDotStarEnclosure): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::atomPatternCharacter): * yarr/YarrInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): (JSC::Yarr::BytecodePattern::estimatedSizeInBytes): (JSC::Yarr::BytecodePattern::ignoreCase): (JSC::Yarr::BytecodePattern::multiline): (JSC::Yarr::BytecodePattern::sticky): (JSC::Yarr::BytecodePattern::unicode): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::matchCharacterClass): (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals): (JSC::Yarr::YarrGenerator::generateAssertionBOL): (JSC::Yarr::YarrGenerator::generateAssertionEOL): (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generateDotStarEnclosure): (JSC::Yarr::YarrGenerator::backtrack): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter): (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::YarrPatternConstructor::optimizeBOL): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::reset): (JSC::Yarr::YarrPattern::nonwordcharCharacterClass): (JSC::Yarr::YarrPattern::ignoreCase): (JSC::Yarr::YarrPattern::multiline): (JSC::Yarr::YarrPattern::sticky): (JSC::Yarr::YarrPattern::unicode): LayoutTests: New and updated tests. * js/Object-getOwnPropertyNames-expected.txt: * js/regexp-flags-expected.txt: * js/regexp-sticky-expected.txt: Added. * js/regexp-sticky.html: Added. * js/script-tests/Object-getOwnPropertyNames.js: * js/script-tests/regexp-flags.js: (RegExp.prototype.hasOwnProperty): Deleted check for sticky property. * js/script-tests/regexp-sticky.js: New test. (asString): (testStickyExec): (testStickyMatch): Canonical link: https://commits.webkit.org/173344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-09 20:11:46 +00:00
PASS BOL Anchored, starting at 0
PASS BOL Anchored, starting at 1
PASS EOL Anchored, not at EOL
PASS EOL Anchored, at EOL
PASS Lookahead Assertion
PASS Lookahead Negative Assertion
PASS Subpatterns - exec
PASS Subpatterns - match
PASS Fixed Count
PASS Greedy
PASS Non-greedy
PASS Greedy/Non-greedy
PASS Counted Range
PASS Character Classes
PASS Unmatched Greedy
PASS Global Flag - exec
PASS Global Flag - match
PASS Global Flag - Alternates, long to short
[ES6] Implement RegExp sticky flag and related functionality https://bugs.webkit.org/show_bug.cgi?id=155177 Reviewed by Saam Barati. Source/JavaScriptCore: Implemented the ES6 RegExp sticky functionality. There are two main behavior changes when the sticky flag is specified. 1) Matching starts at lastIndex and lastIndex is updated after the match. 2) The regular expression is only matched from the start position in the string. See ES6 section 21.2.5.2.2 for details. Changed both the Yarr interpreter and jit to not loop to the next character for sticky RegExp's. Updated RegExp exec and match, and stringProtoFuncMatch to handle lastIndex changes. Restructured the way flags are passed to and through YarrPatterns to use RegExpFlags instead of individual bools. Updated tests for 'y' flag and new behavior. * bytecode/CodeBlock.cpp: (JSC::regexpToSourceString): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * runtime/CommonIdentifiers.h: * runtime/RegExp.cpp: (JSC::regExpFlags): (JSC::RegExpFunctionalTestCollector::outputOneTest): (JSC::RegExp::finishCreation): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * runtime/RegExpKey.h: * runtime/RegExpObjectInlines.h: (JSC::RegExpObject::execInline): (JSC::RegExpObject::matchInline): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::flagsString): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncMatch): * tests/es6.yaml: * tests/stress/static-getter-in-names.js: (shouldBe): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::matchAssertionBOL): (JSC::Yarr::Interpreter::matchAssertionEOL): (JSC::Yarr::Interpreter::matchAssertionWordBoundary): (JSC::Yarr::Interpreter::matchDotStarEnclosure): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::atomPatternCharacter): * yarr/YarrInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): (JSC::Yarr::BytecodePattern::estimatedSizeInBytes): (JSC::Yarr::BytecodePattern::ignoreCase): (JSC::Yarr::BytecodePattern::multiline): (JSC::Yarr::BytecodePattern::sticky): (JSC::Yarr::BytecodePattern::unicode): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::matchCharacterClass): (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals): (JSC::Yarr::YarrGenerator::generateAssertionBOL): (JSC::Yarr::YarrGenerator::generateAssertionEOL): (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generateDotStarEnclosure): (JSC::Yarr::YarrGenerator::backtrack): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter): (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::YarrPatternConstructor::optimizeBOL): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::reset): (JSC::Yarr::YarrPattern::nonwordcharCharacterClass): (JSC::Yarr::YarrPattern::ignoreCase): (JSC::Yarr::YarrPattern::multiline): (JSC::Yarr::YarrPattern::sticky): (JSC::Yarr::YarrPattern::unicode): LayoutTests: New and updated tests. * js/Object-getOwnPropertyNames-expected.txt: * js/regexp-flags-expected.txt: * js/regexp-sticky-expected.txt: Added. * js/regexp-sticky.html: Added. * js/script-tests/Object-getOwnPropertyNames.js: * js/script-tests/regexp-flags.js: (RegExp.prototype.hasOwnProperty): Deleted check for sticky property. * js/script-tests/regexp-sticky.js: New test. (asString): (testStickyExec): (testStickyMatch): Canonical link: https://commits.webkit.org/173344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-09 20:11:46 +00:00
PASS Unicode Flag - Any Character
PASS Unicode & Ignore Case Flags
PASS Multiline
PASS Multiline with BOL Anchor
PASS Multiline with EOL Anchor at start of Alternative
[ES6] Implement RegExp sticky flag and related functionality https://bugs.webkit.org/show_bug.cgi?id=155177 Reviewed by Saam Barati. Source/JavaScriptCore: Implemented the ES6 RegExp sticky functionality. There are two main behavior changes when the sticky flag is specified. 1) Matching starts at lastIndex and lastIndex is updated after the match. 2) The regular expression is only matched from the start position in the string. See ES6 section 21.2.5.2.2 for details. Changed both the Yarr interpreter and jit to not loop to the next character for sticky RegExp's. Updated RegExp exec and match, and stringProtoFuncMatch to handle lastIndex changes. Restructured the way flags are passed to and through YarrPatterns to use RegExpFlags instead of individual bools. Updated tests for 'y' flag and new behavior. * bytecode/CodeBlock.cpp: (JSC::regexpToSourceString): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * runtime/CommonIdentifiers.h: * runtime/RegExp.cpp: (JSC::regExpFlags): (JSC::RegExpFunctionalTestCollector::outputOneTest): (JSC::RegExp::finishCreation): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * runtime/RegExpKey.h: * runtime/RegExpObjectInlines.h: (JSC::RegExpObject::execInline): (JSC::RegExpObject::matchInline): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::flagsString): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncMatch): * tests/es6.yaml: * tests/stress/static-getter-in-names.js: (shouldBe): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::matchAssertionBOL): (JSC::Yarr::Interpreter::matchAssertionEOL): (JSC::Yarr::Interpreter::matchAssertionWordBoundary): (JSC::Yarr::Interpreter::matchDotStarEnclosure): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::atomPatternCharacter): * yarr/YarrInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): (JSC::Yarr::BytecodePattern::estimatedSizeInBytes): (JSC::Yarr::BytecodePattern::ignoreCase): (JSC::Yarr::BytecodePattern::multiline): (JSC::Yarr::BytecodePattern::sticky): (JSC::Yarr::BytecodePattern::unicode): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::matchCharacterClass): (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals): (JSC::Yarr::YarrGenerator::generateAssertionBOL): (JSC::Yarr::YarrGenerator::generateAssertionEOL): (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generateDotStarEnclosure): (JSC::Yarr::YarrGenerator::backtrack): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter): (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::YarrPatternConstructor::optimizeBOL): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::reset): (JSC::Yarr::YarrPattern::nonwordcharCharacterClass): (JSC::Yarr::YarrPattern::ignoreCase): (JSC::Yarr::YarrPattern::multiline): (JSC::Yarr::YarrPattern::sticky): (JSC::Yarr::YarrPattern::unicode): LayoutTests: New and updated tests. * js/Object-getOwnPropertyNames-expected.txt: * js/regexp-flags-expected.txt: * js/regexp-sticky-expected.txt: Added. * js/regexp-sticky.html: Added. * js/script-tests/Object-getOwnPropertyNames.js: * js/script-tests/regexp-flags.js: (RegExp.prototype.hasOwnProperty): Deleted check for sticky property. * js/script-tests/regexp-sticky.js: New test. (asString): (testStickyExec): (testStickyMatch): Canonical link: https://commits.webkit.org/173344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-09 20:11:46 +00:00
PASS "123 1234 ".search(re) is 0
PASS "123 1234 ".search(re) is 0
PASS " 123 1234 ".search(re) is -1
PASS re.test("123 1234 ") is true
PASS re.lastIndex is 4
PASS re.test("123 1234 ") is true
PASS re.lastIndex is 9
PASS re.test("123 1234 ") is false
PASS successfullyParsed is true
TEST COMPLETE