partial VC support

This commit is contained in:
Yukihiro Matsumoto
2012-05-09 08:49:38 +09:00
parent 2e4e7f7cd1
commit f4cf8ea423
13 changed files with 59 additions and 39 deletions
+20 -11
View File
@@ -85,9 +85,9 @@ mrb_reg_s_new_instance(mrb_state *mrb, /*int argc, mrb_value *argv, */mrb_value
//mrb_obj_call_init(obj, argc, argv);...mrb_funcall2(obj, idInitialize, argc, argv);
mrb_value argv[16];
int argc;
struct RRegexp *re;
mrb_get_args(mrb, "*", &argv, &argc);
struct RRegexp *re;
re = mrb_obj_alloc(mrb, MRB_TT_REGEX, mrb->regex_class);
re->ptr = 0;
re->src = 0;
@@ -1861,12 +1861,16 @@ mrb_match_begin(mrb_state *mrb, mrb_value match/*, mrb_value n*/)
{
mrb_value argv[16];
int argc;
mrb_get_args(mrb, "*", &argv, &argc);
mrb_value n = argv[0];
int i = match_backref_number(mrb, match, n);
struct re_registers *regs = RMATCH_REGS(match);
int i;
struct re_registers *regs;
match_check(mrb, match);
mrb_get_args(mrb, "*", &argv, &argc);
n = argv[0];
i = match_backref_number(mrb, match, n);
regs = RMATCH_REGS(match);
if (i < 0 || regs->num_regs <= i)
mrb_raise(mrb, E_INDEX_ERROR, "index %d out of matches", i);
@@ -1944,12 +1948,16 @@ mrb_match_end(mrb_state *mrb, mrb_value match/*, mrb_value n*/)
{
mrb_value argv[16];
int argc;
mrb_get_args(mrb, "*", &argv, &argc);
mrb_value n = argv[0];
int i = match_backref_number(mrb, match, n);
struct re_registers *regs = RMATCH_REGS(match);
mrb_value n;
int i;
struct re_registers *regs;
match_check(mrb, match);
mrb_get_args(mrb, "*", &argv, &argc);
n = argv[0];
i = match_backref_number(mrb, match, n);
regs = RMATCH_REGS(match);
if (i < 0 || regs->num_regs <= i)
mrb_raise(mrb, E_INDEX_ERROR, "index %d out of matches", i);
@@ -2050,11 +2058,12 @@ mrb_match_offset(mrb_state *mrb, mrb_value match/*, mrb_value n*/)
{
mrb_value n;
struct re_registers *regs = RMATCH_REGS(match);
mrb_get_args(mrb, "o", &n);
int i = match_backref_number(mrb, match, n);
int i;
match_check(mrb, match);
mrb_get_args(mrb, "o", &n);
i = match_backref_number(mrb, match, n);
if (i < 0 || regs->num_regs <= i)
mrb_raise(mrb, E_INDEX_ERROR, "index %d out of matches", i);