Changeset 86547 in webkit
- Timestamp:
- May 16, 2011 2:08:07 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r86546 r86547 1 2011-05-16 Gavin Barraclough <barraclough@apple.com> 2 3 Rubber stamped by Geoff Garen. 4 5 https://bugs.webkit.org/show_bug.cgi?id=60866 6 Evaluation order broken for empty alternatives in subpatterns 7 8 Reverted https://bugs.webkit.org/show_bug.cgi?id=51395, and added 9 test cases for /(|a)/ and /(a|)/, to test the evaluation order of 10 subpattern matches with empty alternatives. 11 12 * fast/regex/parentheses-expected.txt: 13 * fast/regex/script-tests/parentheses.js: 14 * fast/regex/script-tests/slow.js: 15 * fast/regex/slow-expected.txt: 16 1 17 2011-05-16 Alejandro G. Castro <alex@igalia.com> 2 18 -
trunk/LayoutTests/fast/regex/parentheses-expected.txt
r86536 r86547 92 92 PASS regexp54.exec('#') is ['','',undefined,undefined,''] 93 93 PASS regexp55.exec('#') is ['',''] 94 PASS regexp56.exec('a') is ['',''] 95 PASS regexp57.exec('a') is ['a','a'] 94 96 PASS successfullyParsed is true 95 97 -
trunk/LayoutTests/fast/regex/script-tests/parentheses.js
r86536 r86547 241 241 shouldBe("regexp55.exec('#')", "['','']"); 242 242 243 // Test evaluation order of empty subpattern alternatives. 244 var regexp56 = /(|a)/; 245 shouldBe("regexp56.exec('a')", "['','']"); 246 var regexp57 = /(a|)/; 247 shouldBe("regexp57.exec('a')", "['a','a']"); 248 243 249 var successfullyParsed = true; 244 250 -
trunk/LayoutTests/fast/regex/script-tests/slow.js
r76502 r86547 3 3 ); 4 4 5 shouldBe('/(?:[^(?!)]||){23}z/.test("/(?:[^(?!)]||){23}z/")', ' true');5 shouldBe('/(?:[^(?!)]||){23}z/.test("/(?:[^(?!)]||){23}z/")', 'false'); 6 6 7 7 var successfullyParsed = true; -
trunk/LayoutTests/fast/regex/slow-expected.txt
r76502 r86547 4 4 5 5 6 PASS /(?:[^(?!)]||){23}z/.test("/(?:[^(?!)]||){23}z/") is true6 PASS /(?:[^(?!)]||){23}z/.test("/(?:[^(?!)]||){23}z/") is false 7 7 PASS successfullyParsed is true 8 8 -
trunk/Source/JavaScriptCore/ChangeLog
r86536 r86547 1 2011-05-16 Gavin Barraclough <barraclough@apple.com> 2 3 Rubber stamped by Geoff Garen. 4 5 https://bugs.webkit.org/show_bug.cgi?id=60866 6 Evaluation order broken for empty alternatives in subpatterns 7 8 Reverting https://bugs.webkit.org/show_bug.cgi?id=51395 9 10 * yarr/YarrPattern.cpp: 11 (JSC::Yarr::YarrPatternConstructor::atomParenthesesEnd): 12 1 13 2011-05-15 Gavin Barraclough <barraclough@apple.com> 2 14 -
trunk/Source/JavaScriptCore/yarr/YarrPattern.cpp
r80217 r86547 492 492 unsigned numParenAlternatives = parenthesesDisjunction->m_alternatives.size(); 493 493 unsigned numBOLAnchoredAlts = 0; 494 bool containsEmptyAlternative = false;495 494 496 495 for (unsigned i = 0; i < numParenAlternatives; i++) { 497 if (!parenthesesDisjunction->m_alternatives[i]->m_terms.size() && numParenAlternatives > 1) {498 PatternAlternative* altToRemove = parenthesesDisjunction->m_alternatives[i];499 parenthesesDisjunction->m_alternatives.remove(i);500 delete altToRemove;501 --numParenAlternatives;502 503 containsEmptyAlternative = true;504 continue;505 }506 507 496 // Bubble up BOL flags 508 497 if (parenthesesDisjunction->m_alternatives[i]->m_startsWithBOL) … … 519 508 lastTerm.parentheses.lastSubpatternId = m_pattern.m_numSubpatterns; 520 509 m_invertParentheticalAssertion = false; 521 522 if (containsEmptyAlternative) {523 // Backup and remove the current disjunction's alternatives.524 Vector<PatternAlternative*> alternatives;525 alternatives.append(parenthesesDisjunction->m_alternatives);526 parenthesesDisjunction->m_alternatives.clear();527 PatternAlternative* alternative = parenthesesDisjunction->addNewAlternative();528 529 // Insert a new non-capturing parentheses.530 unsigned subpatternId = m_pattern.m_numSubpatterns + 1;531 PatternDisjunction* newDisjunction = new PatternDisjunction(alternative);532 m_pattern.m_disjunctions.append(newDisjunction);533 alternative->m_terms.append(PatternTerm(PatternTerm::TypeParenthesesSubpattern, subpatternId, newDisjunction, false, false));534 newDisjunction->m_alternatives.append(alternatives);535 536 // Set the quantifier of the new parentheses to '?' and set the inherited properties.537 PatternTerm& disjunctionTerm = alternative->lastTerm();538 disjunctionTerm.quantify(1, QuantifierGreedy);539 disjunctionTerm.parentheses.lastSubpatternId = m_pattern.m_numSubpatterns;540 alternative->m_containsBOL = m_alternative->m_containsBOL;541 alternative->m_startsWithBOL = m_alternative->m_startsWithBOL;542 }543 510 } 544 511
Note: See TracChangeset
for help on using the changeset viewer.