private static SyntaxState <SelectFieldFunction> squit = AddSyntaxState(new SelectFieldState(30, true)); //quit state; /***************************************************** * s0 -- Select , -- s1 * s1 -- Identitier * -- s2 * s1 -- Top -- s5 * s1 -- Between --s6 * s2 -- AS -- s3 * s2 -- Identitier -- s4 * s2 -- , From -- squit * s3 -- Identitier, String -- s4 * s4 -- , From -- squit * s5 -- Numeric -- s1 * s6 -- Numeric -- s7 * s7 -- To -- s5 * **************************************************/ private static void InitDFAStates() { SyntaxState <SelectFieldFunction> s1 = AddSyntaxState(new SelectFieldState(1, false, SelectFieldFunction.End)); //Attribute start state; SyntaxState <SelectFieldFunction> s2 = AddSyntaxState(new SelectFieldState(2, false, SelectFieldFunction.Name)); SyntaxState <SelectFieldFunction> s3 = AddSyntaxState(new SelectFieldState(3)); SyntaxState <SelectFieldFunction> s4 = AddSyntaxState(new SelectFieldState(4, false, SelectFieldFunction.Alias)); SyntaxState <SelectFieldFunction> s5 = AddSyntaxState(new SelectFieldState(5, false, SelectFieldFunction.Top)); SyntaxState <SelectFieldFunction> s6 = AddSyntaxState(new SelectFieldState(6, false)); SyntaxState <SelectFieldFunction> s7 = AddSyntaxState(new SelectFieldState(7, false, SelectFieldFunction.Begin)); s0.AddNextState(new int[] { (int)SyntaxType.SELECT, (int)SyntaxType.Comma }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Multiply, (int)SyntaxType.String }, s2.Id); s1.AddNextState((int)SyntaxType.TOP, s5.Id); s1.AddNextState((int)SyntaxType.BETWEEN, s6.Id); s2.AddNextState((int)SyntaxType.AS, s3.Id); s2.AddNextState((int)SyntaxType.Identifer, s4.Id); s2.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.FROM }, squit.Id); s3.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s4.Id); s4.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.FROM }, squit.Id); s5.AddNextState((int)SyntaxType.Numeric, s1.Id); s6.AddNextState((int)SyntaxType.Numeric, s7.Id); s7.AddNextState((int)SyntaxType.TO, s5.Id); }
private static SyntaxState <SelectFunction> squit = AddSyntaxState(new SelectState(30, true)); //quit state; /****************************************************** * s0 --Select-- s1 * s1 --,--s1 * s1 --From--s2 * s2 --Eof ;--squit * s2 --Order-- s3 * s2 --Where-- s5 * s3 --By-- s4 * s4 --,-- s4 * s4 --Eof ;--squit * s5 --Order-- s3 * s5 --Eof ;--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <SelectFunction> s1 = AddSyntaxState(new SelectState(1, false, SelectFunction.SelectField)); //Select fields start state; SyntaxState <SelectFunction> s2 = AddSyntaxState(new SelectState(2, false, SelectFunction.From)); //Select from start state; SyntaxState <SelectFunction> s3 = AddSyntaxState(new SelectState(3)); //Select from start state; SyntaxState <SelectFunction> s4 = AddSyntaxState(new SelectState(4, false, SelectFunction.OrderBy)); //Select from start state; SyntaxState <SelectFunction> s5 = AddSyntaxState(new SelectState(5, false, SelectFunction.Where)); //Where start state; s0.AddNextState((int)SyntaxType.SELECT, s1.Id); s1.AddNextState((int)SyntaxType.Comma, s1.Id); s1.AddNextState((int)SyntaxType.FROM, s2.Id); s2.AddNextState((int)SyntaxType.Eof, squit.Id); s2.AddNextState((int)SyntaxType.Semicolon, squit.Id); s2.AddNextState((int)SyntaxType.ORDER, s3.Id); s2.AddNextState((int)SyntaxType.WHERE, s5.Id); s3.AddNextState((int)SyntaxType.BY, s4.Id); s4.AddNextState((int)SyntaxType.Comma, s4.Id); s4.AddNextState((int)SyntaxType.Eof, squit.Id); s4.AddNextState((int)SyntaxType.Semicolon, squit.Id); s5.AddNextState((int)SyntaxType.ORDER, s3.Id); s5.AddNextState((int)SyntaxType.Eof, squit.Id); s5.AddNextState((int)SyntaxType.Semicolon, squit.Id); }
private static SyntaxState <InsertFunction> squit = AddSyntaxState(new InsertState(30, true)); //quit state; /****************************************************** * s0 --Insert-- s1 * s1 --Into--s2 * s1 --Identifer--s3 * s2 --Identifer--s3 * s3 --(-- s4 * s4 --,--s4 * s4 --)--s8 * s3 --Values -- s5 * s8 --Values -- s5 * s5 --(--s6 * s6 --, --s6 * s6 --)--s7 * s7 --EOF ;--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <InsertFunction> s1 = AddSyntaxState(new InsertState(1)); // SyntaxState <InsertFunction> s2 = AddSyntaxState(new InsertState(2)); // SyntaxState <InsertFunction> s3 = AddSyntaxState(new InsertState(3, false, InsertFunction.Table)); // SyntaxState <InsertFunction> s4 = AddSyntaxState(new InsertState(4, false, InsertFunction.Field)); // SyntaxState <InsertFunction> s5 = AddSyntaxState(new InsertState(5)); // SyntaxState <InsertFunction> s6 = AddSyntaxState(new InsertState(6, false, InsertFunction.Value)); // SyntaxState <InsertFunction> s7 = AddSyntaxState(new InsertState(7)); // SyntaxState <InsertFunction> s8 = AddSyntaxState(new InsertState(8)); // s0.AddNextState((int)SyntaxType.INSERT, s1.Id); s1.AddNextState((int)SyntaxType.INTO, s2.Id); s1.AddNextState((int)SyntaxType.Identifer, s3.Id); s2.AddNextState((int)SyntaxType.Identifer, s3.Id); s3.AddNextState((int)SyntaxType.LBracket, s4.Id); s3.AddNextState((int)SyntaxType.VALUES, s5.Id); s4.AddNextState((int)SyntaxType.Comma, s4.Id); s4.AddNextState((int)SyntaxType.RBracket, s8.Id); s8.AddNextState((int)SyntaxType.VALUES, s5.Id); s5.AddNextState((int)SyntaxType.LBracket, s6.Id); s6.AddNextState((int)SyntaxType.Comma, s6.Id); s6.AddNextState((int)SyntaxType.RBracket, s7.Id); s7.AddNextState((int)SyntaxType.Eof, squit.Id); s7.AddNextState((int)SyntaxType.Semicolon, squit.Id); }
private static SyntaxState <ExecParameterFunction> squit = AddSyntaxState(new ExecParameterState(30, true)); //quit state; /***************************************************** * s0 -- String Numeric -- s2 * s0 -- , -- s1 * s1 -- String Numeric --s2 * s2 -- , Eof ;-- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <ExecParameterFunction> s1 = AddSyntaxState(new ExecParameterState(1)); //Attribute start state; SyntaxState <ExecParameterFunction> s2 = AddSyntaxState(new ExecParameterState(2, false, ExecParameterFunction.Value)); s0.AddNextState(new int[] { (int)SyntaxType.String, (int)SyntaxType.Numeric }, s2.Id); s0.AddNextState((int)SyntaxType.Comma, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.String, (int)SyntaxType.Numeric }, s2.Id); s2.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon, (int)SyntaxType.Comma }, squit.Id); }
private static SyntaxState <WhereStateFunction> squit = AddSyntaxState(new WhereState(30, true, WhereStateFunction.Quit)); //quit state; /***************************************************** * s0 -- where -- s1 * s1 -- ( -- s5 * s1 -- Identitier, Numeric, String -- s2 * s2 -- Identitier, Arithmetic Operators, Numeric, String, [ , ] , ^ NOT --s2 * s2 -- Comparision operator -- s3 * s3 -- Identitier, Numeric, String -- s4 * s4 -- Order Group Eof -- squit * s4 -- Identitier, Arithmetic Operators, Numeric, String, [ , ] --s4 * s4 -- ) --s6 * s4 -- AND OR -- s7 * s5 -- Identitier, Numeric, String -- s2 * s5 -- ( -- s5 * s5 -- ) -- s6 * s6 -- AND OR -- s7 * s6 --) --s6 * s6 --Order Group Eof -- squit * s7 -- ( -- s5 * s7 -- Identitier, Numeric, String -- s2 * **************************************************/ private static void InitDFAStates() { SyntaxState <WhereStateFunction> s1 = AddSyntaxState(new WhereState(1)); //start state; SyntaxState <WhereStateFunction> s2 = AddSyntaxState(new WhereState(2, false, WhereStateFunction.Left)); SyntaxState <WhereStateFunction> s3 = AddSyntaxState(new WhereState(3, false, WhereStateFunction.Operator)); SyntaxState <WhereStateFunction> s4 = AddSyntaxState(new WhereState(4, false, WhereStateFunction.Right)); SyntaxState <WhereStateFunction> s5 = AddSyntaxState(new WhereState(5, false, WhereStateFunction.LBracket)); SyntaxState <WhereStateFunction> s6 = AddSyntaxState(new WhereState(6, false, WhereStateFunction.RBracket)); SyntaxState <WhereStateFunction> s7 = AddSyntaxState(new WhereState(7, false, WhereStateFunction.AndOr)); s0.AddNextState((int)SyntaxType.WHERE, s1.Id); s1.AddNextState((int)SyntaxType.LBracket, s5.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Numeric, (int)SyntaxType.String }, s2.Id); s2.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Numeric, (int)SyntaxType.String, (int)SyntaxType.LSquareBracket, (int)SyntaxType.RSquareBracket, (int)SyntaxType.Up }, s2.Id); s2.AddNextState((int)SyntaxType.Plus, (int)SyntaxType.Mod, s2.Id); s2.AddNextState((int)SyntaxType.NOT, s2.Id); //for not match, not like eg. s2.AddNextState((int)SyntaxType.NotEqual, (int)SyntaxType.LargethanEqual, s3.Id); s2.AddNextState(new int[] { (int)SyntaxType.LIKE, (int)SyntaxType.MATCH, (int)SyntaxType.MATCH1, (int)SyntaxType.MATCH2, (int)SyntaxType.MATCH3, (int)SyntaxType.CONTAINS, (int)SyntaxType.CONTAINS1, (int)SyntaxType.CONTAINS2, (int)SyntaxType.CONTAINS3 }, s3.Id); s3.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Numeric, (int)SyntaxType.String }, s4.Id); s4.AddNextState(new int[] { (int)SyntaxType.GROUP, (int)SyntaxType.ORDER, (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s4.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Numeric, (int)SyntaxType.String, (int)SyntaxType.LSquareBracket, (int)SyntaxType.RSquareBracket }, s4.Id); s4.AddNextState((int)SyntaxType.Plus, (int)SyntaxType.Mod, s4.Id); s4.AddNextState(new int[] { (int)SyntaxType.AND, (int)SyntaxType.OR }, s7.Id); s4.AddNextState((int)SyntaxType.RBracket, s6.Id); s5.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Numeric, (int)SyntaxType.String }, s2.Id); s5.AddNextState((int)SyntaxType.LBracket, s5.Id); s5.AddNextState((int)SyntaxType.RBracket, s6.Id); s6.AddNextState(new int[] { (int)SyntaxType.AND, (int)SyntaxType.OR }, s7.Id); s6.AddNextState((int)SyntaxType.RBracket, s6.Id); s6.AddNextState(new int[] { (int)SyntaxType.GROUP, (int)SyntaxType.ORDER, (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s7.AddNextState((int)SyntaxType.LBracket, s5.Id); s7.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.Numeric, (int)SyntaxType.String }, s2.Id); }
private static SyntaxState <DeleteFunction> squit = AddSyntaxState(new DeleteState(30, true)); //quit state; /****************************************************** * s0 --Delete-- s1 * s1 --Eof--squit * s1 --Where-- s2 * s2 --Eof ;--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <DeleteFunction> s1 = AddSyntaxState(new DeleteState(1, false, DeleteFunction.From)); //Select fields start state; SyntaxState <DeleteFunction> s2 = AddSyntaxState(new DeleteState(2, false, DeleteFunction.Where)); //Select from start state; s0.AddNextState((int)SyntaxType.DELETE, s1.Id); s1.AddNextState((int)SyntaxType.Eof, squit.Id); s1.AddNextState((int)SyntaxType.WHERE, s2.Id); s2.AddNextState((int)SyntaxType.Eof, squit.Id); s2.AddNextState((int)SyntaxType.Semicolon, squit.Id); }
private static SyntaxState <OrderByStateFunction> squit = AddSyntaxState(new OrderByState(30, true)); //quit state; /***************************************************** * s0 -- by , -- s1 * s1 -- Identitier -- s2 * s2 -- ASC DESC -- s3 * s2 -- , Eof -- squit * s3 -- , Eof -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <OrderByStateFunction> s1 = AddSyntaxState(new OrderByState(1)); //Attribute start state; SyntaxState <OrderByStateFunction> s2 = AddSyntaxState(new OrderByState(2, false, OrderByStateFunction.Name)); SyntaxState <OrderByStateFunction> s3 = AddSyntaxState(new OrderByState(3, false, OrderByStateFunction.Order)); s0.AddNextState(new int[] { (int)SyntaxType.BY, (int)SyntaxType.Comma }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s2.Id); s2.AddNextState(new int[] { (int)SyntaxType.ASC, (int)SyntaxType.DESC }, s3.Id); s2.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Comma, (int)SyntaxType.Semicolon }, squit.Id); s3.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Comma, (int)SyntaxType.Semicolon }, squit.Id); }
private static SyntaxState <DeleteFromStateFunction> squit = AddSyntaxState(new DeleteFromState(30, true)); //quit state; /***************************************************** * s0 -- Delete , -- s1 * s1 -- Identitier -- s3 * s1 -- From -- s2 * s2 -- Identitier -- s3 * s3 -- Where, Eof -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <DeleteFromStateFunction> s1 = AddSyntaxState(new DeleteFromState(1)); SyntaxState <DeleteFromStateFunction> s2 = AddSyntaxState(new DeleteFromState(2)); SyntaxState <DeleteFromStateFunction> s3 = AddSyntaxState(new DeleteFromState(3, false, DeleteFromStateFunction.Name)); s0.AddNextState((int)SyntaxType.DELETE, s1.Id); s1.AddNextState((int)SyntaxType.Identifer, s3.Id); s1.AddNextState((int)SyntaxType.FROM, s2.Id); s2.AddNextState((int)SyntaxType.Identifer, s3.Id); s3.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.WHERE }, squit.Id); }
private static SyntaxState <ExecFunction> squit = AddSyntaxState(new ExecState(30, true)); //quit state; /****************************************************** * s0 --Exec-- s1 * s1 --Identifer--s2 * s2 --Eof ;--squit * s2 --String Numeric--s3 * s3 --,--s3 * s3 --Eof ;--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <ExecFunction> s1 = AddSyntaxState(new ExecState(1)); SyntaxState <ExecFunction> s2 = AddSyntaxState(new ExecState(2, false, ExecFunction.Name)); SyntaxState <ExecFunction> s3 = AddSyntaxState(new ExecState(3, false, ExecFunction.Para)); s0.AddNextState((int)SyntaxType.EXEC, s1.Id); s1.AddNextState((int)SyntaxType.Identifer, s2.Id); s2.AddNextState(new int[] { (int)SyntaxType.String, (int)SyntaxType.Numeric }, s3.Id); s2.AddNextState(new int[] { (int)SyntaxType.Semicolon, (int)SyntaxType.Eof }, squit.Id); s3.AddNextState((int)SyntaxType.Comma, s3.Id); s3.AddNextState(new int[] { (int)SyntaxType.Semicolon, (int)SyntaxType.Eof }, squit.Id); }
private static SyntaxState <InsertTableNameStateFunction> squit = AddSyntaxState(new InsertTableNameState(30, true)); //quit state; /***************************************************** * s0 -- Identitier -- s1 * s1 -- ( Values -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <InsertTableNameStateFunction> s1 = AddSyntaxState(new InsertTableNameState(1, false, InsertTableNameStateFunction.Name)); s0.AddNextState((int)SyntaxType.Identifer, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.LBracket, (int)SyntaxType.VALUES }, squit.Id); }
private static SyntaxState <UpdateFunction> squit = AddSyntaxState(new UpdateState(30, true)); //quit state; /****************************************************** * s0 --Update-- s1 * s1 --Set--s2 * s2 --,--s2 * s2 --Where-- s3 * s2 --Eof ;--squit * s3 --Eof ;--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <UpdateFunction> s1 = AddSyntaxState(new UpdateState(1, false, UpdateFunction.Table)); // SyntaxState <UpdateFunction> s2 = AddSyntaxState(new UpdateState(2, false, UpdateFunction.Field)); // SyntaxState <UpdateFunction> s3 = AddSyntaxState(new UpdateState(3, false, UpdateFunction.Where)); // s0.AddNextState((int)SyntaxType.UPDATE, s1.Id); s1.AddNextState((int)SyntaxType.SET, s2.Id); s2.AddNextState((int)SyntaxType.Comma, s2.Id); s2.AddNextState((int)SyntaxType.WHERE, s3.Id); s2.AddNextState((int)SyntaxType.Eof, squit.Id); s2.AddNextState((int)SyntaxType.Semicolon, squit.Id); s3.AddNextState((int)SyntaxType.Eof, squit.Id); s3.AddNextState((int)SyntaxType.Semicolon, squit.Id); }
private static SyntaxState <CreateTableFunction> squit = AddSyntaxState(new CreateTableState(30, true)); //quit state; /****************************************************** * s0 --Table-- s1 * s1 --Identifer--s2 * s2 --(--s3 * s3 --)--s4 * s3 --,-- s3 * s4 --Eof ;--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <CreateTableFunction> s1 = AddSyntaxState(new CreateTableState(1)); SyntaxState <CreateTableFunction> s2 = AddSyntaxState(new CreateTableState(2, false, CreateTableFunction.TableName)); SyntaxState <CreateTableFunction> s3 = AddSyntaxState(new CreateTableState(3, false, CreateTableFunction.Field)); SyntaxState <CreateTableFunction> s4 = AddSyntaxState(new CreateTableState(4)); s0.AddNextState((int)SyntaxType.TABLE, s1.Id); s1.AddNextState((int)SyntaxType.Identifer, s2.Id); s2.AddNextState((int)SyntaxType.LBracket, s3.Id); s3.AddNextState((int)SyntaxType.RBracket, s4.Id); s3.AddNextState((int)SyntaxType.Comma, s3.Id); s4.AddNextState((int)SyntaxType.Eof, squit.Id); s4.AddNextState((int)SyntaxType.Semicolon, squit.Id); }
private static SyntaxState <TSFQLAttrFunction> squit = AddSyntaxState(new TSFQLAttrState(30, true)); //quit state; /***************************************************** * s0 -- [ -- s1 * s1 -- Identitier -- s2 * s2 -- ] -- squit * s2 -- ( -- s3 * s3 -- String, Numeric -- s4 * s4 -- ) -- s5 * s4 -- , -- s3 * s5 -- ] -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <TSFQLAttrFunction> s1 = AddSyntaxState(new TSFQLAttrState(1)); //Attribute start state; SyntaxState <TSFQLAttrFunction> s2 = AddSyntaxState(new TSFQLAttrState(2, false, TSFQLAttrFunction.Name)); SyntaxState <TSFQLAttrFunction> s3 = AddSyntaxState(new TSFQLAttrState(3)); SyntaxState <TSFQLAttrFunction> s4 = AddSyntaxState(new TSFQLAttrState(4, false, TSFQLAttrFunction.Parameter)); SyntaxState <TSFQLAttrFunction> s5 = AddSyntaxState(new TSFQLAttrState(5)); s0.AddNextState((int)SyntaxType.LSquareBracket, s1.Id); s1.AddNextState((int)SyntaxType.Identifer, s2.Id); s1.AddNextState((int)SyntaxType.BEGIN_KEYWORD, (int)SyntaxType.END_KEYWORD, s2.Id); s2.AddNextState((int)SyntaxType.RSquareBracket, squit.Id); s2.AddNextState((int)SyntaxType.LBracket, s3.Id); s3.AddNextState(new int[] { (int)SyntaxType.String, (int)SyntaxType.Numeric }, s4.Id); s4.AddNextState((int)SyntaxType.RBracket, s5.Id); s4.AddNextState((int)SyntaxType.Comma, s3.Id); s5.AddNextState((int)SyntaxType.RSquareBracket, squit.Id); }
private static SyntaxState <InsertValueFunction> squit = AddSyntaxState(new InsertValueState(30, true)); //quit state; /***************************************************** * s0 -- ( , -- s1 * s1 -- String Numeric NULL -- s2 * s2 -- , ) --squit * **************************************************/ private static void InitDFAStates() { SyntaxState <InsertValueFunction> s1 = AddSyntaxState(new InsertValueState(1)); // SyntaxState <InsertValueFunction> s2 = AddSyntaxState(new InsertValueState(2, false, InsertValueFunction.Value)); s0.AddNextState(new int[] { (int)SyntaxType.LBracket, (int)SyntaxType.Comma }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.String, (int)SyntaxType.Numeric, (int)SyntaxType.NULL }, s2.Id); s2.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); }
private static SyntaxState <UpdateTableNameStateFunction> squit = AddSyntaxState(new UpdateTableNameState(30, true)); //quit state; /***************************************************** * s0 -- Update , -- s1 * s1 -- Identitier -- s2 * s2 -- Set -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <UpdateTableNameStateFunction> s1 = AddSyntaxState(new UpdateTableNameState(1)); SyntaxState <UpdateTableNameStateFunction> s2 = AddSyntaxState(new UpdateTableNameState(2, false, UpdateTableNameStateFunction.Name)); s0.AddNextState((int)SyntaxType.UPDATE, s1.Id); s1.AddNextState((int)SyntaxType.Identifer, s2.Id); s2.AddNextState((int)SyntaxType.SET, squit.Id); }
private static SyntaxState <SelectFromStateFunction> squit = AddSyntaxState(new SelectFromState(30, true)); //quit state; /***************************************************** * s0 -- From , -- s1 * s1 -- Identitier,string -- s2 * s2 -- AS -- s3 * s2 -- Identitier, string -- s4 * s2 -- , Where, Eof, Order, Group -- squit * s3 -- Identitier -- s4 * s4 -- , Where, Eof, Order, Group -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <SelectFromStateFunction> s1 = AddSyntaxState(new SelectFromState(1)); //Attribute start state; SyntaxState <SelectFromStateFunction> s2 = AddSyntaxState(new SelectFromState(2, false, SelectFromStateFunction.Name)); SyntaxState <SelectFromStateFunction> s3 = AddSyntaxState(new SelectFromState(3)); SyntaxState <SelectFromStateFunction> s4 = AddSyntaxState(new SelectFromState(4, false, SelectFromStateFunction.Alias)); s0.AddNextState(new int[] { (int)SyntaxType.FROM, (int)SyntaxType.Comma }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s2.Id); s2.AddNextState((int)SyntaxType.AS, s3.Id); s2.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s4.Id); s2.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Comma, (int)SyntaxType.WHERE, (int)SyntaxType.ORDER, (int)SyntaxType.GROUP, (int)SyntaxType.Semicolon }, squit.Id); s3.AddNextState((int)SyntaxType.Identifer, s4.Id); s4.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Comma, (int)SyntaxType.WHERE, (int)SyntaxType.ORDER, (int)SyntaxType.GROUP, (int)SyntaxType.Semicolon }, squit.Id); }
private static SyntaxState <InsertFieldFunction> squit = AddSyntaxState(new InsertFieldState(30, true)); //quit state; /***************************************************** * s0 -- ( , -- s1 * s1 -- [ -- s3 * s1 -- Identifer -- s2 * s2 -- , ) --squit * s3 -- Identifer, Keywords -- s2 * s2 -- ] -- s4 * s4 -- , ) --squit * **************************************************/ private static void InitDFAStates() { SyntaxState <InsertFieldFunction> s1 = AddSyntaxState(new InsertFieldState(1)); // SyntaxState <InsertFieldFunction> s2 = AddSyntaxState(new InsertFieldState(2, false, InsertFieldFunction.Name)); SyntaxState <InsertFieldFunction> s3 = AddSyntaxState(new InsertFieldState(3)); // SyntaxState <InsertFieldFunction> s4 = AddSyntaxState(new InsertFieldState(4)); // s0.AddNextState(new int[] { (int)SyntaxType.LBracket, (int)SyntaxType.Comma }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s2.Id); s1.AddNextState((int)SyntaxType.LSquareBracket, s3.Id); s2.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s3.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s2.Id); s3.AddNextState((int)SyntaxType.BEGIN_KEYWORD, (int)SyntaxType.END_KEYWORD, s2.Id); s2.AddNextState((int)SyntaxType.RSquareBracket, s4.Id); s4.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); }
private static SyntaxState <TSFQLSentenceFunction> squit = AddSyntaxState(new TSFQLState(30, true)); //quit state; /*********************************************************** * s0 -- [ -- s1 * s0 -- Select --s3 * s0 -- Delete --s4 * s0 -- Update --s5 * s0 -- Insert --s6 * s0 -- Exec -- s7 * s0 -- Create-- s8 * s8 -- Table -- s9 * s1 -- ] -- s2 * s2 -- [ -- s1 * s2 -- EOF ; -- squit * s2 -- Select -- s3 * s2 -- Delete -- s4 * s2 -- Update -- s5 * s2 -- Insert -- s6 * s2 -- Exec -- s7 * s2 -- Create-- s8 * s3 -- EOF ; -- squit * s4 -- EOF ; -- squit * s5 -- EOF ; -- squit * s6 -- EOF ; -- squit * s7 -- EOF ; -- squit * s9 -- EOF ; -- squit * ********************************************************/ private static void InitDFAStates() { SyntaxState <TSFQLSentenceFunction> s1 = AddSyntaxState(new TSFQLState(1, false, TSFQLSentenceFunction.Attribute)); //Attribute start state; SyntaxState <TSFQLSentenceFunction> s2 = AddSyntaxState(new TSFQLState(2)); //Attribute end state; SyntaxState <TSFQLSentenceFunction> s3 = AddSyntaxState(new TSFQLState(3, false, TSFQLSentenceFunction.Select)); //select state; SyntaxState <TSFQLSentenceFunction> s4 = AddSyntaxState(new TSFQLState(4, false, TSFQLSentenceFunction.Delete)); //delete state; SyntaxState <TSFQLSentenceFunction> s5 = AddSyntaxState(new TSFQLState(5, false, TSFQLSentenceFunction.Update)); //update state; SyntaxState <TSFQLSentenceFunction> s6 = AddSyntaxState(new TSFQLState(6, false, TSFQLSentenceFunction.Insert)); //insert state; SyntaxState <TSFQLSentenceFunction> s7 = AddSyntaxState(new TSFQLState(7, false, TSFQLSentenceFunction.Exec)); //Exec state; SyntaxState <TSFQLSentenceFunction> s8 = AddSyntaxState(new TSFQLState(8)); //Create; SyntaxState <TSFQLSentenceFunction> s9 = AddSyntaxState(new TSFQLState(9, false, TSFQLSentenceFunction.CreateTable)); //create table; s0.AddNextState((int)SyntaxType.LSquareBracket, s1.Id); s0.AddNextState((int)SyntaxType.SELECT, s3.Id); s0.AddNextState((int)SyntaxType.DELETE, s4.Id); s0.AddNextState((int)SyntaxType.UPDATE, s5.Id); s0.AddNextState((int)SyntaxType.INSERT, s6.Id); s0.AddNextState((int)SyntaxType.EXEC, s7.Id); s0.AddNextState((int)SyntaxType.CREATE, s8.Id); s1.AddNextState((int)SyntaxType.RSquareBracket, s2.Id); s2.AddNextState((int)SyntaxType.LSquareBracket, s1.Id); s2.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s2.AddNextState((int)SyntaxType.SELECT, s3.Id); s2.AddNextState((int)SyntaxType.DELETE, s4.Id); s2.AddNextState((int)SyntaxType.UPDATE, s5.Id); s2.AddNextState((int)SyntaxType.INSERT, s6.Id); s2.AddNextState((int)SyntaxType.EXEC, s7.Id); s2.AddNextState((int)SyntaxType.CREATE, s8.Id); s3.AddNextState(new int[] { (int)SyntaxType.FROM, (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s4.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s5.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s6.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s7.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); s8.AddNextState((int)SyntaxType.TABLE, s9.Id); s9.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.Semicolon }, squit.Id); //s1.AddNextState((int)SyntaxType.RSquareBracket, s2.Id); //s2.AddNextState((int)SyntaxType.LSquareBracket, s1.Id); //s2.AddNextState((int)SyntaxType.SELECT, s3.Id); //s3.AddElseState(squit.Id); }
private static SyntaxState <UpdateFieldFunction> squit = AddSyntaxState(new UpdateFieldState(30, true)); //quit state; /***************************************************** * s0 -- Set , -- s1 * s1 -- Identitier -- s2 * s2 -- = -- s3 * s3 -- String, Numeric -- s4 * s4 -- , Where Eof -- squit * **************************************************/ private static void InitDFAStates() { SyntaxState <UpdateFieldFunction> s1 = AddSyntaxState(new UpdateFieldState(1)); //Attribute start state; SyntaxState <UpdateFieldFunction> s2 = AddSyntaxState(new UpdateFieldState(2, false, UpdateFieldFunction.Name)); SyntaxState <UpdateFieldFunction> s3 = AddSyntaxState(new UpdateFieldState(3)); SyntaxState <UpdateFieldFunction> s4 = AddSyntaxState(new UpdateFieldState(4, false, UpdateFieldFunction.Value)); s0.AddNextState(new int[] { (int)SyntaxType.SET, (int)SyntaxType.Comma }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s2.Id); s2.AddNextState((int)SyntaxType.Equal, s3.Id); s3.AddNextState(new int[] { (int)SyntaxType.Numeric, (int)SyntaxType.String }, s4.Id); s4.AddNextState(new int[] { (int)SyntaxType.Eof, (int)SyntaxType.WHERE, (int)SyntaxType.Comma }, squit.Id); }
private static SyntaxState <CreateTableFieldFunction> squit = AddSyntaxState(new CreateTableFieldState(30, true)); //quit state; /****************************************************** * s0 --(,-- s1 * s1 --Identifer, string--s2 //Field name * s2 --Identifer--s3 //Type * s3 --(--s4 //length * s3 --Tokenized UnTokenized None--s7 * s3 --Analyzer--s8 * s3 --NULL--s10 * s3 --NOT --s11 * s3 --DEFAULT --s13 * s3 --PRIMARY --s15 * s3 --FASTEST --s17 * s3 --,)--squit * * s4 --Numeric MAX-- s5 //length * s5 --)-- s6 //length * s6 --Tokenized UnTokenized None--s7 * s6 --Analyzer--s8 * s6 --NULL--s10 * s6 --NOT --s11 * s6 --DEFAULT --s13 * s6 --PRIMARY --s15 * s6 --FASTEST --s17 * s6 --,)--squit * * s7 --Analyzer--s8 * s7 --NULL--s10 * s7 --NOT --s11 * s7 --DEFAULT --s13 * s7 --PRIMARY --s15 * s7 --,)--squit * * s8 --String-- s9 * s9 --Tokenized UnTokenized None--s7 * s9 --NULL--s10 * s9 --NOT --s11 * s9 --DEFAULT --s13 * s9 --PRIMARY --s15 * s9 --FASTEST --s17 * s9 --,)--squit * * s10 --Tokenized UnTokenized None--s7 * s10 --Analyzer--s8 * s10 --DEFAULT --s13 * s10 --PRIMARY --s15 * s10 --FASTEST --s17 * s10 --,)--squit * * s11 --NULL--s12 * s12 --Tokenized UnTokenized None--s7 * s12 --Analyzer--s8 * s12 --DEFAULT --s13 * s12 --PRIMARY --s15 * s12 --FASTEST --s17 * s12 --,)--squit * * s13 --String Numeric --s14 * s14 --Tokenized UnTokenized None--s7 * s14 --Analyzer--s8 * s14 --NULL--s10 * s14 --NOT --s11 * s14 --PRIMARY --s15 * s14 --,)--squit * s14 --FASTEST --s17 * * s15 --KEY--s16 * s16 --Tokenized UnTokenized None--s7 * s16 --Analyzer--s8 * s16 --NULL--s10 * s16 --NOT --s11 * s16 --DEFAULT --s13 * s16 --FASTEST --s17 * s16 --,)--squit * * s17 --Tokenized UnTokenized None--s7 * s17 --Analyzer--s8 * s17 --NULL--s10 * s17 --NOT --s11 * s17 --DEFAULT --s13 * s17 --PRIMARY --s15 * s17 --,)--squit * **************************************************/ private static void InitDFAStates() { SyntaxState <CreateTableFieldFunction> s1 = AddSyntaxState(new CreateTableFieldState(1)); SyntaxState <CreateTableFieldFunction> s2 = AddSyntaxState(new CreateTableFieldState(2, false, CreateTableFieldFunction.Name)); SyntaxState <CreateTableFieldFunction> s3 = AddSyntaxState(new CreateTableFieldState(3, false, CreateTableFieldFunction.Type)); SyntaxState <CreateTableFieldFunction> s4 = AddSyntaxState(new CreateTableFieldState(4)); SyntaxState <CreateTableFieldFunction> s5 = AddSyntaxState(new CreateTableFieldState(5, false, CreateTableFieldFunction.Length)); SyntaxState <CreateTableFieldFunction> s6 = AddSyntaxState(new CreateTableFieldState(6)); SyntaxState <CreateTableFieldFunction> s7 = AddSyntaxState(new CreateTableFieldState(7, false, CreateTableFieldFunction.Tokenized)); SyntaxState <CreateTableFieldFunction> s8 = AddSyntaxState(new CreateTableFieldState(8)); SyntaxState <CreateTableFieldFunction> s9 = AddSyntaxState(new CreateTableFieldState(9, false, CreateTableFieldFunction.Analyzer)); SyntaxState <CreateTableFieldFunction> s10 = AddSyntaxState(new CreateTableFieldState(10, false, CreateTableFieldFunction.NULL)); SyntaxState <CreateTableFieldFunction> s11 = AddSyntaxState(new CreateTableFieldState(11)); SyntaxState <CreateTableFieldFunction> s12 = AddSyntaxState(new CreateTableFieldState(12, false, CreateTableFieldFunction.NOTNULL)); SyntaxState <CreateTableFieldFunction> s13 = AddSyntaxState(new CreateTableFieldState(13)); SyntaxState <CreateTableFieldFunction> s14 = AddSyntaxState(new CreateTableFieldState(14, false, CreateTableFieldFunction.DEAFAULT)); SyntaxState <CreateTableFieldFunction> s15 = AddSyntaxState(new CreateTableFieldState(15, false)); SyntaxState <CreateTableFieldFunction> s16 = AddSyntaxState(new CreateTableFieldState(16, false, CreateTableFieldFunction.PRIMARYKEY)); SyntaxState <CreateTableFieldFunction> s17 = AddSyntaxState(new CreateTableFieldState(17, false, CreateTableFieldFunction.FASTEST)); s0.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.LBracket }, s1.Id); s1.AddNextState(new int[] { (int)SyntaxType.Identifer, (int)SyntaxType.String }, s2.Id); s2.AddNextState((int)SyntaxType.Identifer, s3.Id); s3.AddNextState((int)SyntaxType.LBracket, s4.Id); s3.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s3.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s3.AddNextState((int)SyntaxType.NULL, s10.Id); s3.AddNextState((int)SyntaxType.NOT, s11.Id); s3.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s3.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s3.AddNextState((int)SyntaxType.FASTEST, s17.Id); s3.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s4.AddNextState((int)SyntaxType.Numeric, s5.Id); s4.AddNextState((int)SyntaxType.MAX, s5.Id); s5.AddNextState((int)SyntaxType.RBracket, s6.Id); s6.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s6.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s6.AddNextState((int)SyntaxType.NULL, s10.Id); s6.AddNextState((int)SyntaxType.NOT, s11.Id); s6.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s6.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s6.AddNextState((int)SyntaxType.FASTEST, s17.Id); s6.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s7.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s7.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s7.AddNextState((int)SyntaxType.NULL, s10.Id); s7.AddNextState((int)SyntaxType.NOT, s11.Id); s7.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s7.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s8.AddNextState((int)SyntaxType.String, s9.Id); s9.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s9.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s9.AddNextState((int)SyntaxType.NULL, s10.Id); s9.AddNextState((int)SyntaxType.NOT, s11.Id); s9.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s9.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s9.AddNextState((int)SyntaxType.FASTEST, s17.Id); s10.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s10.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s10.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s10.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s10.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s10.AddNextState((int)SyntaxType.FASTEST, s17.Id); s11.AddNextState((int)SyntaxType.NULL, s12.Id); s12.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s12.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s12.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s12.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s12.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s12.AddNextState((int)SyntaxType.FASTEST, s17.Id); s13.AddNextState(new int[] { (int)SyntaxType.String, (int)SyntaxType.Numeric }, s14.Id); s14.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s14.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s14.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s14.AddNextState((int)SyntaxType.NULL, s10.Id); s14.AddNextState((int)SyntaxType.NOT, s11.Id); s14.AddNextState((int)SyntaxType.PRIMARY, s15.Id); s14.AddNextState((int)SyntaxType.FASTEST, s17.Id); s15.AddNextState((int)SyntaxType.KEY, s16.Id); s16.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s16.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s16.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s16.AddNextState((int)SyntaxType.NULL, s10.Id); s16.AddNextState((int)SyntaxType.NOT, s11.Id); s16.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s16.AddNextState((int)SyntaxType.FASTEST, s17.Id); s17.AddNextState(new int[] { (int)SyntaxType.Comma, (int)SyntaxType.RBracket }, squit.Id); s17.AddNextState((int)SyntaxType.ANALYZER, s8.Id); s17.AddNextState(new int[] { (int)SyntaxType.TOKENIZED, (int)SyntaxType.UNTOKENIZED, (int)SyntaxType.NONE }, s7.Id); s17.AddNextState((int)SyntaxType.NULL, s10.Id); s17.AddNextState((int)SyntaxType.NOT, s11.Id); s17.AddNextState((int)SyntaxType.DEFAULT, s13.Id); s17.AddNextState((int)SyntaxType.PRIMARY, s15.Id); }