mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
19991214
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c18d3740a9
commit
9d228b13de
34 changed files with 649 additions and 508 deletions
26
re.c
26
re.c
|
@ -507,6 +507,32 @@ rb_reg_prepare_re(reg)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
rb_reg_adjust_startpos(reg, str, pos, reverse)
|
||||
VALUE reg, str;
|
||||
int pos, reverse;
|
||||
{
|
||||
int range;
|
||||
|
||||
if (may_need_recompile)
|
||||
rb_reg_prepare_re(reg);
|
||||
|
||||
if (FL_TEST(reg, KCODE_FIXED))
|
||||
kcode_set_option(reg);
|
||||
else if (reg_kcode != curr_kcode)
|
||||
kcode_reset_option();
|
||||
|
||||
if (reverse) {
|
||||
range = -pos;
|
||||
}
|
||||
else {
|
||||
range = RSTRING(str)->len - pos;
|
||||
}
|
||||
return re_adjust_startpos(RREGEXP(reg)->ptr,
|
||||
RSTRING(str)->ptr, RSTRING(str)->len,
|
||||
pos, range);
|
||||
}
|
||||
|
||||
int
|
||||
rb_reg_search(reg, str, pos, reverse)
|
||||
VALUE reg, str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue