System.Text.RegularExpressions.RegexWriter.Write C# (CSharp) Method

Write() static private method

This is the only function that should be called from outside. It takes a RegexTree and creates a corresponding RegexCode.
static private Write ( RegexTree t ) : RegexCode
t RegexTree
return RegexCode
        internal static RegexCode Write(RegexTree t)
        {
            RegexWriter w = new RegexWriter();
            RegexCode retval = w.RegexCodeFromRegexTree(t);
            #if DEBUG
            if (t.Debug)
            {
                t.Dump();
                retval.Dump();
            }
            #endif
            return retval;
        }

Usage Example

コード例 #1
0
ファイル: Regex.cs プロジェクト: z77ma/runtime
        private void Init(string pattern, RegexOptions options, TimeSpan matchTimeout, CultureInfo culture)
        {
            ValidatePattern(pattern);
            ValidateOptions(options);
            ValidateMatchTimeout(matchTimeout);

            this.pattern         = pattern;
            internalMatchTimeout = matchTimeout;
            roptions             = options;

            // Parse the input
            RegexTree tree = RegexParser.Parse(pattern, roptions, culture);

            // Generate the RegexCode from the node tree.  This is required for interpreting,
            // and is used as input into RegexOptions.Compiled and RegexOptions.NonBacktracking.
            _code = RegexWriter.Write(tree, culture);

            if ((options & RegexOptions.NonBacktracking) != 0)
            {
                // NonBacktracking doesn't support captures (other than the implicit top-level capture).
                capnames = null;
                capslist = null;
                caps     = null;
                capsize  = 1;
            }
            else
            {
                capnames = tree.CapNames;
                capslist = tree.CapsList;
                caps     = _code.Caps;
                capsize  = _code.CapSize;
            }
        }
All Usage Examples Of System.Text.RegularExpressions.RegexWriter::Write