/// <summary> /// This is the only function that should be called from outside. /// It takes a RegexTree and creates a corresponding RegexCode. /// </summary> public static RegexCode Write(RegexTree tree) { var writer = new RegexWriter(); RegexCode code = writer.RegexCodeFromRegexTree(tree); #if DEBUG if (tree.Debug) { tree.Dump(); code.Dump(); } #endif return(code); }
private RegexCSharpCompiler(TextWriter writer, string pattern, RegexOptions options, CultureInfo culture, string @namespace, string className) { Pattern = pattern; Tree = RegexParser.Parse(pattern, options, culture); Code = RegexWriter.Write(Tree); Writer = new CSharpWriter(writer); Codes = Code.Codes; Operations = Operation.GenerateFromCodes(Codes); Strings = Code.Strings; FirstCharacterPrefix = Code.FCPrefix; BoyerMoorePrefix = Code.BMPrefix; Anchors = new Anchors(Code.Anchors); TrackCount = Code.TrackCount; Options = options; Namespace = @namespace; ClassName = className; }