internal RedisSqlQueryEngine() { _hashClient = new RedisHashStorageClient(); _stringClient = new RedisStringStorageClient(); _zSetClient = new RedisZSetStorageClient(); _setClient = new RedisSetStorageClient(); _conditionalTokenizer = new ConditionalLexicalTokenizer(); _whereParser = new ShiftReduceParser(Constants.WhereGrammar); }
public static void PrintParsingTable <TTokenKind, TNonterminal>( this IShiftReduceParser <TTokenKind, TNonterminal> parser, TextWriter writer ) where TTokenKind : struct, Enum where TNonterminal : struct, Enum { var actionTable = new TableBuilder() .SetTitle("ACTION") .SetColumns(new Column("State", 8).AsSingletonEnumerable() .Concat(parser.Terminals.Select(token => new Column(token.Name, 5)))) .Build(); var actionTableWriter = new TextTableWriter(actionTable, writer); actionTableWriter.WriteHead(); foreach (var state in parser.GetStates()) { actionTableWriter.WriteRow(state.ToString().AsSingletonEnumerable() .Concat(parser.Terminals.Select(terminal => parser.Action(state, terminal).ToTableString())).ToArray()); } actionTableWriter.WriteFooter(); var gotoTable = new TableBuilder() .SetTitle("GOTO") .SetColumns(new Column("State", 8).AsSingletonEnumerable() .Concat(parser.TrimmedNonTerminalSymbols.Select(nonterminal => new Column(nonterminal.Name, 5)))) .Build(); var gotoTableWriter = new TextTableWriter(gotoTable, writer); gotoTableWriter.WriteHead(); foreach (var state in parser.GetStates()) { gotoTableWriter.WriteRow(state.ToString().AsSingletonEnumerable() .Concat(parser.TrimmedNonTerminalSymbols.Select(nonterminal => parser.Goto(state, nonterminal).ToGotoTableString())).ToArray()); } gotoTableWriter.WriteFooter(); }