>>>>> "Y" == Yukihiro Matsumoto <matz / zetabits.com> writes:

Y>   * backreferences corresponding to unclosed/unmatched parentheses
Y>     should fail always.

 This is not what do perl, and this will be a difference from perl/ruby.

 For perl a reference exist only *after* it has found the close ')'
     ruby    ....                *when*    ......         open  '('

 This mean that perl can re-use a previous backreference, for example this
 is valid in perl

  "aaaaaa" =~  /^(a\1?)(a\1?)(a\2?)(a\3?)$/

 and it must give the result $1 = "a", $2 = "aa", $3 = "a", $4 = "aa" (this
 is extract from the tests of perl).

 i.e. the perl-mechanism for this will be something like this in ruby
 (pseudo-modification) 

          d2 = IS_ACTIVE(reg_info[regno])?old_regstart[regno]:regstart[regno];
          if (REG_UNSET(d2)) goto fail;

          dend2 = regend[regno];
          if (REG_UNSET(dend2)) goto fail;



Guy Decoux