Reset() private method

private Reset ( RegexOptions topopts ) : void
topopts RegexOptions
return void
Exemplo n.º 1
0
        // This static call constructs a RegexTree from a regular expression
        // pattern string and an option string.
        //
        // The method creates, drives, and drops a parser instance.
        internal static RegexTree Parse(String re, RegexOptions op) {
            RegexParser p;
            RegexNode root;
            String[] capnamelist;

            p = new RegexParser((op & RegexOptions.CultureInvariant) != 0 ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);

            p._options = op;

            p.SetPattern(re);
            p.CountCaptures();
            p.Reset(op);
            root = p.ScanRegex();

            if (p._capnamelist == null)
                capnamelist = null;
            else
                capnamelist = (String[])p._capnamelist.ToArray(typeof(String));

            return new RegexTree(root, p._caps, p._capnumlist, p._captop, p._capnames, capnamelist, op);
        }
 internal static RegexTree Parse(string re, RegexOptions op)
 {
     string[] strArray;
     RegexParser parser = new RegexParser(((op & RegexOptions.CultureInvariant) != RegexOptions.None) ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture) {
         _options = op
     };
     parser.SetPattern(re);
     parser.CountCaptures();
     parser.Reset(op);
     RegexNode root = parser.ScanRegex();
     if (parser._capnamelist == null)
     {
         strArray = null;
     }
     else
     {
         strArray = parser._capnamelist.ToArray();
     }
     return new RegexTree(root, parser._caps, parser._capnumlist, parser._captop, parser._capnames, strArray, op);
 }