/// <summary> /// Generate C# code for matching the DFA. /// </summary> /// <param name="indent"></param> /// <returns></returns> public string Generate(string indent, ReCodeGenerator generator) { var scope = new GeneratorScope(generator, indent); scope.WriteLine("/*"); _root.Print(generator.StringBuilder, scope.Indentation + " * ", scope.Indentation + " * "); scope.WriteLine(" */"); foreach (var state in _dfaStates) { GenerateCode(scope, state.EvaluationNode); } return(generator.StringBuilder.ToString()); }
/// <summary> /// Used for generating code for regular expressions. /// </summary> public static IEnumerable <IReCodeGenerator> RegularExpressionTokens(Action <string> writeLine) { var gen = new ReCodeGenerator(); return(gen.Generate(writeLine)); }