summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-29 08:03:51 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-29 08:03:51 +0000
commitd5c8ad535961968b40823512ccdb12e38f1ed529 (patch)
treeec9fda92b59a605bc0a836f625a71e871a23a6a7 /insns.def
parent65615986ec0cfc5971c990abe46643b0edbcab8d (diff)
* insns.def (toregexp): generate a regexp from strings instead of one
string. * re.c (rb_reg_new_ary): defined for toregexp. it concatenates strings after each string is preprocessed. * compile.c (compile_dstr_fragments): split from compile_dstr. (compile_dstr): call compile_dstr_fragments. (compile_dregx): defined for dynamic regexp. (iseq_compile_each): use compile_dregx for dynamic regexp. [ruby-dev:33400] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def17
1 files changed, 12 insertions, 5 deletions
diff --git a/insns.def b/insns.def
index ec8ffa77e5..755a7d3fa2 100644
--- a/insns.def
+++ b/insns.def
@@ -397,12 +397,19 @@ tostring
*/
DEFINE_INSN
toregexp
-(rb_num_t opt)
-(VALUE str)
-(VALUE val)
+(rb_num_t opt, rb_num_t cnt)
+(...)
+(VALUE val) // inc += 1 - cnt;
{
- volatile VALUE tmp = str; /* for GC */
- val = rb_reg_new_str(str, opt);
+ VALUE rb_reg_new_ary(VALUE ary, int options);
+ int i;
+ VALUE ary = rb_ary_new2(cnt);
+ RBASIC(ary)->klass = 0;
+ for (i = 0; i < cnt; i++) {
+ rb_ary_store(ary, cnt-i-1, TOPN(i));
+ }
+ POPN(cnt);
+ val = rb_reg_new_ary(ary, opt);
}
/**