static internal void Init(NetRuby rb) { rb.eRegexpError = rb.DefineClass("RegexpError", rb.eStandardError); rb.DefineVirtualVariable("$~", new GlobalEntry.Getter(matchGetter), new GlobalEntry.Setter(matchSetter)); rb.DefineVirtualVariable("$&", new GlobalEntry.Getter(lastMatchGetter), null); rb.DefineVirtualVariable("$`", new GlobalEntry.Getter(preMatchGetter), null); rb.DefineVirtualVariable("$'", new GlobalEntry.Getter(postMatchGetter), null); rb.DefineVirtualVariable("$+", new GlobalEntry.Getter(lastParenGetter), null); rb.DefineVirtualVariable("$=", new GlobalEntry.Getter(iCaseGetter), new GlobalEntry.Setter(iCaseSetter)); rb.DefineVirtualVariable("$KCODE", new GlobalEntry.Getter(kCodeGetter), new GlobalEntry.Setter(kCodeSetter)); rb.DefineVirtualVariable("$-K", new GlobalEntry.Getter(kCodeGetter), new GlobalEntry.Setter(kCodeSetter)); RRegexpClass reg = new RRegexpClass(rb); reg.DefineClass("Regexp", rb.cObject); rb.cRegexp = reg; reg.DefineSingletonMethod("new", new RMethod(s_new), -1); reg.DefineSingletonMethod("compile", new RMethod(s_new), -1); reg.DefineSingletonMethod("quote", new RMethod(s_quote), -1); reg.DefineSingletonMethod("escape", new RMethod(s_quote), -1); reg.DefineSingletonMethod("last_match", new RMethod(s_lastmatch), 0); reg.DefineMethod("initialize", new RMethod(initialize), -1); reg.DefineMethod("=~", new RMethod(match), 1); reg.DefineMethod("===", new RMethod(match), 1); reg.DefineMethod("~", new RMethod(match2), 0); reg.DefineMethod("match", new RMethod(match_m), 1); reg.DefineMethod("source", new RMethod(source), 0); reg.DefineMethod("casefold?", new RMethod(casefold_p), 0); reg.DefineMethod("kcode", new RMethod(kcode_m), 0); reg.DefineConst("IGNORECASE", RegexOptions.IgnoreCase); reg.DefineConst("EXTENDED", RegexOptions.IgnorePatternWhitespace); reg.DefineConst("MULTILINE", RegexOptions.Multiline); RClass md = rb.DefineClass("MatchData", rb.cObject); rb.DefineGlobalConst("MatchingData", md); rb.cMatch = md; rb.ClassOf(md).UndefMethod("new"); md.DefineMethod("size", new RMethod(match_size), 0); md.DefineMethod("length", new RMethod(match_size), 0); md.DefineMethod("offset", new RMethod(match_offset), 1); md.DefineMethod("begin", new RMethod(match_begin), 1); md.DefineMethod("end", new RMethod(match_end), 1); md.DefineMethod("to_a", new RMethod(match_to_a), 0); md.DefineMethod("[]", new RMethod(match_aref), -1); md.DefineMethod("pre_match", new RMethod(match_pre), 0); md.DefineMethod("post_match", new RMethod(match_post), 0); md.DefineMethod("to_s", new RMethod(match_to_s), 0); md.DefineMethod("string", new RMethod(match_string), 0); }