return f_to_r(context, real);
}
static RubyArray str_to_c_internal(ThreadContext context, IRubyObject recv) {
RubyString s = recv.convertToString();
ByteList bytes = s.getByteList();
Ruby runtime = context.getRuntime();
if (bytes.realSize == 0) return runtime.newArray(runtime.getNil(), recv);
IRubyObject sr, si, re;
sr = si = re = runtime.getNil();
boolean po = false;
IRubyObject m = RubyRegexp.newRegexp(runtime, Numeric.ComplexPatterns.comp_pat0).callMethod(context, "match", s);
if (!m.isNil()) {
sr = m.callMethod(context, "[]", RubyFixnum.one(runtime));
si = m.callMethod(context, "[]", RubyFixnum.two(runtime));
re = m.callMethod(context, "post_match");
po = true;
}
if (m.isNil()) {
m = RubyRegexp.newRegexp(runtime, Numeric.ComplexPatterns.comp_pat1).callMethod(context, "match", s);
if (!m.isNil()) {
sr = runtime.getNil();
si = m.callMethod(context, "[]", RubyFixnum.one(runtime));
if (si.isNil()) si = runtime.newString();
IRubyObject t = m.callMethod(context, "[]", RubyFixnum.two(runtime));
if (t.isNil()) t = runtime.newString(new ByteList(new byte[]{'1'}));
si.convertToString().cat(t.convertToString().getByteList());
re = m.callMethod(context, "post_match");
po = false;
}
}
if (m.isNil()) {
m = RubyRegexp.newRegexp(runtime, Numeric.ComplexPatterns.comp_pat2).callMethod(context, "match", s);
if (m.isNil()) return runtime.newArray(runtime.getNil(), recv);
sr = m.callMethod(context, "[]", RubyFixnum.one(runtime));
if (m.callMethod(context, "[]", RubyFixnum.two(runtime)).isNil()) {
si = runtime.getNil();
} else {
si = m.callMethod(context, "[]", RubyFixnum.three(runtime));
IRubyObject t = m.callMethod(context, "[]", RubyFixnum.four(runtime));
if (t.isNil()) t = runtime.newString(new ByteList(new byte[]{'1'}));
si.convertToString().cat(t.convertToString().getByteList());
}
re = m.callMethod(context, "post_match");
po = false;
}
IRubyObject r = RubyFixnum.zero(runtime);
IRubyObject i = r;
if (!sr.isNil()) {
if (sr.callMethod(context, "include?", runtime.newString(new ByteList(new byte[]{'/'}))).isTrue()) {
r = f_to_r(context, sr);
} else if (f_gt_p(context, sr.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue()) {
r = f_to_f(context, sr);
} else {
r = f_to_i(context, sr);
}
}
if (!si.isNil()) {
if (si.callMethod(context, "include?", runtime.newString(new ByteList(new byte[]{'/'}))).isTrue()) {
i = f_to_r(context, si);
} else if (f_gt_p(context, si.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue()) {
i = f_to_f(context, si);
} else {
i = f_to_i(context, si);