From: matz@... (Yukihiro Matsumoto) Date: 2001-10-06T23:08:51+09:00 Subject: [ruby-talk:22160] Re: Match expressions Hi, In message "[ruby-talk:22145] Match expressions" on 01/10/06, Alan Moore writes: |In other words, match_gen |should only return a NODE_MATCH2 (with L and R swapped, if |appropriate) or a CALL, and there's no need for NODE_MATCH3 at |all. What am I missing? I often confuse left and right even after I've grown up. | /* nodes for speed-up(literal match) */ | case NODE_MATCH3: | { | VALUE r = rb_eval(self,node->nd_recv); | VALUE l = rb_eval(self,node->nd_value); | if (TYPE(r) == T_STRING) { | result = rb_reg_match(l, r); | } | else { | result = rb_funcall(r, match, 1, l); | } | } | break; This should be: case NODE_MATCH3: { VALUE r = rb_eval(self,node->nd_recv); VALUE l = rb_eval(self,node->nd_value); if (TYPE(l) == T_STRING) { result = rb_reg_match(r, l); } else { result = rb_funcall(l, match, 1, r); } } break; Sorry. matz.