\r
this.factory = cache.Lookup (pattern, options);\r
\r
- if (this.factory == null) {\r
- // parse and install group mapping\r
+ // parse and install group mapping\r
\r
- Parser psr = new Parser ();\r
- RegularExpression re = psr.ParseRegularExpression (pattern, options);\r
- this.group_count = re.GroupCount;\r
- this.mapping = psr.GetMapping ();\r
+ Parser psr = new Parser ();\r
+ RegularExpression re = psr.ParseRegularExpression (pattern, options);\r
+ this.group_count = re.GroupCount;\r
+ this.mapping = psr.GetMapping ();\r
\r
+ if (this.factory == null) {\r
// compile\r
\r
ICompiler cmp;\r
- if ((options & RegexOptions.Compiled) != 0)\r
- throw new Exception ("Not implemented.");\r
+ //if ((options & RegexOptions.Compiled) != 0)\r
+ // throw new Exception ("Not implemented.");\r
//cmp = new CILCompiler ();\r
- else\r
+ //else\r
cmp = new PatternCompiler ();\r
\r
re.Compile (cmp, RightToLeft);\r
}\r
}\r
\r
+ protected Regex (SerializationInfo info, StreamingContext context) :\r
+ this (info.GetString ("pattern"), \r
+ (RegexOptions) info.GetValue ("options", typeof (RegexOptions))) { \r
+ }\r
+\r
+\r
// public instance properties\r
\r
public RegexOptions Options {\r
count = Int32.MaxValue;\r
\r
int ptr = startat;\r
- Match m = Match (input, startat);\r
- while (count -- > 0 && m.Success) {\r
+ while (count -- > 0) {\r
+ Match m = Match (input, ptr);\r
+ if (!m.Success)\r
+ break;\r
+ \r
splits.Add (input.Substring (ptr, m.Index - ptr));\r
ptr = m.Index + m.Length;\r
}\r
}\r
\r
// ISerializable interface\r
-\r
- public void GetObjectData (SerializationInfo info, StreamingContext context) {\r
- throw new Exception ("Not implemented.");\r
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context) {\r
+ info.AddValue ("pattern", this.ToString (), typeof (string));\r
+ info.AddValue ("options", this.Options, typeof (RegexOptions));\r
}\r
\r
// internal\r