private void WriteRegex(RubyRegex /*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(RubyRegex)); _writer.Write((byte)'/'); WriteStringValue(value.GetPattern()); _writer.Write((byte)value.Options); }
public static MutableString /*!*/ Inspect(RubyRegex /*!*/ self) { MutableString result = MutableString.CreateMutable(); result.Append('/'); AppendEscapeForwardSlash(result, self.GetPattern()); result.Append('/'); AppendOptionString(result, self.Options, true, true); return(result); }
private static MutableString /*!*/ Append(RubyRegex /*!*/ self, MutableString /*!*/ result) { Assert.NotNull(self, result); result.Append("(?"); if (AppendOptionString(result, self.Options, true, false) < 3) { result.Append('-'); } AppendOptionString(result, self.Options, false, false); result.Append(':'); AppendEscapeForwardSlash(result, self.GetPattern()); result.Append(')'); return(result); }
public static RubyRegex /*!*/ Reinitialize(RubyRegex /*!*/ self, [NotNull] RubyRegex /*!*/ other) { self.Set(other.GetPattern(), other.Options); return(self); }
public static MutableString /*!*/ Source(RubyRegex /*!*/ self) { return(self.GetPattern()); }
private object /*!*/ ReadUserClass() { object obj = UnmarshalNewObject(); bool loaded = false; int typeFlag = _reader.ReadByte(); switch (typeFlag) { case '"': MutableString msc = (obj as MutableString); if (msc != null) { msc.Replace(0, msc.Length, ReadString()); loaded = true; } break; case '/': RubyRegex rsc = (obj as RubyRegex); if (rsc != null) { RubyRegex regex = ReadRegex(); rsc.Set(regex.GetPattern(), regex.Options); loaded = true; } break; case '[': RubyArray asc = (obj as RubyArray); if (asc != null) { asc.AddRange(ReadArray()); loaded = true; } break; case '{': case '}': Hash hsc = (obj as Hash); if (hsc != null) { Hash hash = ReadHash(typeFlag); hsc.DefaultProc = hash.DefaultProc; hsc.DefaultValue = hash.DefaultValue; foreach (var pair in hash) { hsc.Add(pair.Key, pair.Value); } loaded = true; } break; default: break; } if (!loaded) { throw RubyExceptions.CreateArgumentError("incompatible base type"); } return(obj); }