Bug 67455 - Different regular expression result
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 00:22:04 +0000 (00:22 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 00:22:04 +0000 (00:22 +0000)
commit4d83841114c01eedba0fc293b8219bb75379f507
tree85fa99685a2e9c31ab2d7668bd92a4264f39c374
parentdf3d1492098b7190e37db4a92452f97b269b9072
Bug 67455 - Different regular expression result

Reviewed by Darin Adler.

Fix a regression introduced in r72140. A return was added to the backtracking loop for
backtrackParentheses with QuantifierNonGreedy, so it always returns after one iteration.
This is incorrect. The additional return should only trigger to force an early return if
an error has occured.

Source/JavaScriptCore:

* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::matchParentheses):
    - Simplify some nested if else logic.
(JSC::Yarr::Interpreter::backtrackParentheses):
    - Simplify some nested if else logic.
    - Only return early from backtrackParentheses on success/error, not on failure.

LayoutTests:

* fast/regex/parentheses-expected.txt:
* fast/regex/script-tests/parentheses.js:
    - Added test cases from bug.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/regex/parentheses-expected.txt
LayoutTests/fast/regex/script-tests/parentheses.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/yarr/YarrInterpreter.cpp