/// <summary> /// Get the DFA and NFA graphs for a given regular expression and highlight active /// states for a given input string /// </summary> /// <param name="regex">Regular expression</param> /// <param name="input">Input string</param> /// <param name="minimize">Minimize the resulting DFA</param> /// <param name="nfaString">Dot notation NFA graph</param> /// <param name="dfaString">Dot notation DFA graph</param> public static void GetDfaAndNfaGraphs(string regex, string input, bool minimize, bool ignorecase, out string nfaString, out string dfaString) { NFA nfa = NfaBuilder.Create(new ShuntingYard(new RegExLexer(new StringReader(regex))), ignorecase); nfaString = nfa.AsDotNotation(input, "NFA"); DFA dfa = DFA.Create(nfa); if (minimize) { dfa.Minimize(); } dfaString = dfa.AsDotNotation(input, "DFA"); }