Make absent operator work at the end of the input string
https://bugs.ruby-lang.org/issues/19104#change-100542
This commit is contained in:
parent
f093b619a4
commit
b8e542b463
Notes:
git
2022-12-12 05:26:56 +00:00
@ -3774,6 +3774,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
|
|||||||
DATA_ENSURE(0);
|
DATA_ENSURE(0);
|
||||||
p += addr;
|
p += addr;
|
||||||
}
|
}
|
||||||
|
else if (s == end) {
|
||||||
|
/* At the end of the string, just match with it */
|
||||||
|
DATA_ENSURE(0);
|
||||||
|
p += addr;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
STACK_PUSH_ALT(p + addr, s, sprev, pkeep); /* Push possible point. */
|
STACK_PUSH_ALT(p + addr, s, sprev, pkeep); /* Push possible point. */
|
||||||
n = enclen(encode, s, end);
|
n = enclen(encode, s, end);
|
||||||
|
@ -1525,6 +1525,9 @@ class TestRegexp < Test::Unit::TestCase
|
|||||||
|
|
||||||
assert_equal(0, /(?~(a)c)/ =~ "abb")
|
assert_equal(0, /(?~(a)c)/ =~ "abb")
|
||||||
assert_nil($1)
|
assert_nil($1)
|
||||||
|
|
||||||
|
assert_equal(0, /(?~(a))/ =~ "")
|
||||||
|
assert_nil($1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_backref_overrun
|
def test_backref_overrun
|
||||||
|
Loading…
x
Reference in New Issue
Block a user