public static ProxyLexer GetCompiledLexer(string lexerName, IReadOnlyCollection <string> regexes) { var result = LexerCompiler.GetCompiledLexer(lexerName, regexes); if (result != null) { return(result); } var lexer = new Lexer((from regex in regexes select RegExParser.Parse(regex)).ToArray(), lexerName, regexes); return(lexer._engine ?? new ProxyLexer(lexer.Process)); // If compilation failed or was impossible fallback to DFA based Process }
private static ProxyLexer CompileLexer(DfaUtils.MinimizedDfa <char> dfa, string lexerName, IReadOnlyCollection <string> regexes) { return(LexerCompiler.CompileLexer <DfaUtils.MinimizedDfa <char>, DfaUtils.MinimizedDfaState <char> >(dfa, lexerName, regexes)); }