public virtual void Visit(TableOptions node)
 {
 }
 public virtual DdlCreateTableStatement SetTableOptions(TableOptions tableOptions)
 {
     TableOptions = tableOptions;
     return this;
 }
        /// <summary><code>TABLE</code> has been consumed</summary>
        /// <exception cref="System.SqlSyntaxErrorException" />
        private DdlCreateTableStatement CreateTable(bool temp)
        {
            var ifNotExists = false;
            if (lexer.Token() == MySqlToken.KwIf)
            {
                lexer.NextToken();
                Match(MySqlToken.KwNot);
                Match(MySqlToken.KwExists);
                ifNotExists = true;
            }
            var table = Identifier();
            var stmt = new DdlCreateTableStatement(temp, ifNotExists, table);
            CreateTableDefs(stmt);
            var options = new DdlTableOptions();
            stmt.SetTableOptions(options);
            TableOptions(options);
            var selectOpt = CreateTableSelectOption.None;
            switch (lexer.Token())
            {
                case MySqlToken.KwIgnore:
                {
                    selectOpt = CreateTableSelectOption.Ignored;
                    if (lexer.NextToken() == MySqlToken.KwAs)
                    {
                        lexer.NextToken();
                    }
                    break;
                }

                case MySqlToken.KwReplace:
                {
                    selectOpt = CreateTableSelectOption.Replace;
                    if (lexer.NextToken() == MySqlToken.KwAs)
                    {
                        lexer.NextToken();
                    }
                    break;
                }

                case MySqlToken.KwAs:
                {
                    lexer.NextToken();
                    goto case MySqlToken.KwSelect;
                }

                case MySqlToken.KwSelect:
                {
                    break;
                }

                case MySqlToken.Eof:
                {
                    return stmt;
                }

                default:
                {
                    throw new SqlSyntaxErrorException("Ddl CREATE TABLE statement not end properly");
                }
            }
            var select = new MySqlDmlSelectParser(lexer, exprParser).Select();
            stmt.SetSelect(selectOpt, select);
            Match(MySqlToken.Eof);
            return stmt;
        }
        /// <summary>token of table name has been consumed</summary>
        /// <exception cref="System.SqlSyntaxErrorException" />
        private DdlAlterTableStatement AlterTable(DdlAlterTableStatement stmt)
        {
            var options = new DdlTableOptions();
            stmt.TableOptions = options;
            Identifier id = null;
            Identifier id2 = null;
            Identifier id3 = null;
            DdlColumnDefinition colDef = null;
            IndexDefinition indexDef = null;
            IExpression expr = null;
            for (var i = 0; lexer.Token() != MySqlToken.Eof; ++i)
            {
                if (i > 0)
                {
                    Match(MySqlToken.PuncComma);
                }
                if (TableOptions(options))
                {
                    continue;
                }
                switch (lexer.Token())
                {
                    case MySqlToken.KwConvert:
                    {
                        // | CONVERT TO CHARACTER SET charset_name [COLLATE
                        // collation_name]
                        lexer.NextToken();
                        Match(MySqlToken.KwTo);
                        Match(MySqlToken.KwCharacter);
                        Match(MySqlToken.KwSet);
                        id = Identifier();
                        id2 = null;
                        if (lexer.Token() == MySqlToken.KwCollate)
                        {
                            lexer.NextToken();
                            id2 = Identifier();
                        }
                        stmt.ConvertCharset = new Pair<Identifier, Identifier>(id, id2);
                        goto main_switch_break;
                    }

                    case MySqlToken.KwRename:
                    {
                        // | RENAME [TO] new_tbl_name
                        if (lexer.NextToken() == MySqlToken.KwTo)
                        {
                            lexer.NextToken();
                        }
                        id = Identifier();
                        stmt.RenameTo = id;
                        goto main_switch_break;
                    }

                    case MySqlToken.KwDrop:
                    {
                        switch (lexer.NextToken())
                        {
                            case MySqlToken.KwIndex:
                            case MySqlToken.KwKey:
                            {
                                // | DROP {INDEX|KEY} index_name
                                lexer.NextToken();
                                id = Identifier();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.DropIndex(id));
                                goto drop_switch_break;
                            }

                            case MySqlToken.KwPrimary:
                            {
                                // | DROP PRIMARY KEY
                                lexer.NextToken();
                                Match(MySqlToken.KwKey);
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.DropPrimaryKey());
                                goto drop_switch_break;
                            }

                            case MySqlToken.Identifier:
                            {
                                // | DROP [COLUMN] col_name
                                id = Identifier();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.DropColumn(id));
                                goto drop_switch_break;
                            }

                            case MySqlToken.KwColumn:
                            {
                                // | DROP [COLUMN] col_name
                                lexer.NextToken();
                                id = Identifier();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.DropColumn(id));
                                goto drop_switch_break;
                            }

                            default:
                            {
                                throw new SqlSyntaxErrorException("ALTER TABLE error for DROP");
                            }
                        }
                        drop_switch_break:
                        ;
                        goto main_switch_break;
                    }

                    case MySqlToken.KwChange:
                    {
                        // | CHANGE [COLUMN] old_col_name new_col_name column_definition
                        // [FIRST|AFTER col_name]
                        if (lexer.NextToken() == MySqlToken.KwColumn)
                        {
                            lexer.NextToken();
                        }
                        id = Identifier();
                        id2 = Identifier();
                        colDef = ColumnDefinition();
                        if (lexer.Token() == MySqlToken.Identifier)
                        {
                            if ("FIRST".Equals(lexer.GetStringValueUppercase()))
                            {
                                lexer.NextToken();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.ChangeColumn(id, id2, colDef
                                    , null));
                            }
                            else
                            {
                                if ("AFTER".Equals(lexer.GetStringValueUppercase()))
                                {
                                    lexer.NextToken();
                                    id3 = Identifier();
                                    stmt.AddAlterSpecification(new DdlAlterTableStatement.ChangeColumn(id, id2, colDef
                                        , id3));
                                }
                                else
                                {
                                    stmt.AddAlterSpecification(new DdlAlterTableStatement.ChangeColumn(id, id2, colDef
                                        ));
                                }
                            }
                        }
                        else
                        {
                            stmt.AddAlterSpecification(new DdlAlterTableStatement.ChangeColumn(id, id2, colDef
                                ));
                        }
                        goto main_switch_break;
                    }

                    case MySqlToken.KwAlter:
                    {
                        // | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP
                        // DEFAULT}
                        if (lexer.NextToken() == MySqlToken.KwColumn)
                        {
                            lexer.NextToken();
                        }
                        id = Identifier();
                        switch (lexer.Token())
                        {
                            case MySqlToken.KwSet:
                            {
                                lexer.NextToken();
                                Match(MySqlToken.KwDefault);
                                expr = exprParser.Expression();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AlterColumnDefaultVal(id, expr
                                    ));
                                break;
                            }

                            case MySqlToken.KwDrop:
                            {
                                lexer.NextToken();
                                Match(MySqlToken.KwDefault);
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AlterColumnDefaultVal(id));
                                break;
                            }

                            default:
                            {
                                throw new SqlSyntaxErrorException("ALTER TABLE error for ALTER");
                            }
                        }
                        goto main_switch_break;
                    }

                    case MySqlToken.KwAdd:
                    {
                        switch (lexer.NextToken())
                        {
                            case MySqlToken.Identifier:
                            {
                                // | ADD [COLUMN] col_name column_definition [FIRST | AFTER
                                // col_name ]
                                id = Identifier();
                                colDef = ColumnDefinition();
                                if (lexer.Token() == MySqlToken.Identifier)
                                {
                                    if ("FIRST".Equals(lexer.GetStringValueUppercase()))
                                    {
                                        lexer.NextToken();
                                        stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id, colDef, null));
                                    }
                                    else
                                    {
                                        if ("AFTER".Equals(lexer.GetStringValueUppercase()))
                                        {
                                            lexer.NextToken();
                                            id2 = Identifier();
                                            stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id, colDef,
                                                id2));
                                        }
                                        else
                                        {
                                            stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id, colDef));
                                        }
                                    }
                                }
                                else
                                {
                                    stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id, colDef));
                                }
                                goto add_switch_break;
                            }

                            case MySqlToken.PuncLeftParen:
                            {
                                // | ADD [COLUMN] (col_name column_definition,...)
                                lexer.NextToken();
                                for (var j = 0; lexer.Token() != MySqlToken.PuncRightParen; ++j)
                                {
                                    var addColumns = new DdlAlterTableStatement.AddColumns();
                                    stmt.AddAlterSpecification(addColumns);
                                    if (j > 0)
                                    {
                                        Match(MySqlToken.PuncComma);
                                    }
                                    id = Identifier();
                                    colDef = ColumnDefinition();
                                    addColumns.AddColumn(id, colDef);
                                }
                                Match(MySqlToken.PuncRightParen);
                                goto add_switch_break;
                            }

                            case MySqlToken.KwColumn:
                            {
                                if (lexer.NextToken() == MySqlToken.PuncLeftParen)
                                {
                                    // | ADD [COLUMN] (col_name column_definition,...)
                                    lexer.NextToken();
                                    for (var j_1 = 0; lexer.Token() != MySqlToken.PuncRightParen; ++j_1)
                                    {
                                        var addColumns = new DdlAlterTableStatement.AddColumns();
                                        stmt.AddAlterSpecification(addColumns);
                                        if (j_1 > 0)
                                        {
                                            Match(MySqlToken.PuncComma);
                                        }
                                        id = Identifier();
                                        colDef = ColumnDefinition();
                                        addColumns.AddColumn(id, colDef);
                                    }
                                    Match(MySqlToken.PuncRightParen);
                                }
                                else
                                {
                                    // | ADD [COLUMN] col_name column_definition [FIRST |
                                    // AFTER col_name ]
                                    id = Identifier();
                                    colDef = ColumnDefinition();
                                    if (lexer.Token() == MySqlToken.Identifier)
                                    {
                                        if ("FIRST".Equals(lexer.GetStringValueUppercase()))
                                        {
                                            lexer.NextToken();
                                            stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id, colDef,
                                                null));
                                        }
                                        else
                                        {
                                            if ("AFTER".Equals(lexer.GetStringValueUppercase()))
                                            {
                                                lexer.NextToken();
                                                id2 = Identifier();
                                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id,
                                                    colDef, id2));
                                            }
                                            else
                                            {
                                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id,
                                                    colDef));
                                            }
                                        }
                                    }
                                    else
                                    {
                                        stmt.AddAlterSpecification(new DdlAlterTableStatement.AddColumn(id, colDef));
                                    }
                                }
                                goto add_switch_break;
                            }

                            case MySqlToken.KwIndex:
                            case MySqlToken.KwKey:
                            {
                                // | ADD {INDEX|KEY} [index_name] [index_type]
                                // (index_col_name,...) [index_option] ...
                                id = null;
                                if (lexer.NextToken() == MySqlToken.Identifier)
                                {
                                    id = Identifier();
                                }
                                indexDef = IndexDefinition();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddIndex(id, indexDef));
                                goto add_switch_break;
                            }

                            case MySqlToken.KwPrimary:
                            {
                                // | ADD PRIMARY KEY [index_type] (index_col_name,...)
                                // [index_option] ...
                                lexer.NextToken();
                                Match(MySqlToken.KwKey);
                                indexDef = IndexDefinition();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddPrimaryKey(indexDef));
                                goto add_switch_break;
                            }

                            case MySqlToken.KwUnique:
                            {
                                switch (lexer.NextToken())
                                {
                                    case MySqlToken.KwIndex:
                                    case MySqlToken.KwKey:
                                    {
                                        // | ADD UNIQUE [INDEX|KEY] [index_name] [index_type]
                                        // (index_col_name,...) [index_option] ...
                                        lexer.NextToken();
                                        break;
                                    }
                                }
                                id = null;
                                if (lexer.Token() == MySqlToken.Identifier)
                                {
                                    id = Identifier();
                                }
                                indexDef = IndexDefinition();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddUniqueKey(id, indexDef));
                                goto add_switch_break;
                            }

                            case MySqlToken.KwFulltext:
                            {
                                switch (lexer.NextToken())
                                {
                                    case MySqlToken.KwIndex:
                                    case MySqlToken.KwKey:
                                    {
                                        // | ADD FULLTEXT [INDEX|KEY] [index_name]
                                        // (index_col_name,...) [index_option] ...
                                        lexer.NextToken();
                                        break;
                                    }
                                }
                                id = null;
                                if (lexer.Token() == MySqlToken.Identifier)
                                {
                                    id = Identifier();
                                }
                                indexDef = IndexDefinition();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddFullTextIndex(id, indexDef
                                    ));
                                goto add_switch_break;
                            }

                            case MySqlToken.KwSpatial:
                            {
                                switch (lexer.NextToken())
                                {
                                    case MySqlToken.KwIndex:
                                    case MySqlToken.KwKey:
                                    {
                                        // | ADD SPATIAL [INDEX|KEY] [index_name]
                                        // (index_col_name,...) [index_option] ...
                                        lexer.NextToken();
                                        break;
                                    }
                                }
                                id = null;
                                if (lexer.Token() == MySqlToken.Identifier)
                                {
                                    id = Identifier();
                                }
                                indexDef = IndexDefinition();
                                stmt.AddAlterSpecification(new DdlAlterTableStatement.AddSpatialIndex(id, indexDef
                                    ));
                                goto add_switch_break;
                            }

                            default:
                            {
                                throw new SqlSyntaxErrorException("ALTER TABLE error for ADD");
                            }
                        }
                        add_switch_break:
                        ;
                        goto main_switch_break;
                    }

                    case MySqlToken.Identifier:
                    {
                        var si = specialIdentifiers.GetValue(lexer.GetStringValueUppercase());
                        if (si != SpecialIdentifier.None)
                        {
                            switch (si)
                            {
                                case SpecialIdentifier.Import:
                                {
                                    // | IMPORT TABLESPACE
                                    lexer.NextToken();
                                    MatchIdentifier("TABLESPACE");
                                    stmt.IsImportTableSpace = true;
                                    goto main_switch_break;
                                }

                                case SpecialIdentifier.Discard:
                                {
                                    // | DISCARD TABLESPACE
                                    lexer.NextToken();
                                    MatchIdentifier("TABLESPACE");
                                    stmt.DiscardTableSpace = true;
                                    goto main_switch_break;
                                }

                                case SpecialIdentifier.Enable:
                                {
                                    // | ENABLE KEYS
                                    lexer.NextToken();
                                    Match(MySqlToken.KwKeys);
                                    stmt.EnableKeys = true;
                                    goto main_switch_break;
                                }

                                case SpecialIdentifier.Disable:
                                {
                                    // | DISABLE KEYS
                                    lexer.NextToken();
                                    Match(MySqlToken.KwKeys);
                                    stmt.DisableKeys = true;
                                    goto main_switch_break;
                                }

                                case SpecialIdentifier.Modify:
                                {
                                    // | MODIFY [COLUMN] col_name column_definition [FIRST |
                                    // AFTER col_name]
                                    if (lexer.NextToken() == MySqlToken.KwColumn)
                                    {
                                        lexer.NextToken();
                                    }
                                    id = Identifier();
                                    colDef = ColumnDefinition();
                                    if (lexer.Token() == MySqlToken.Identifier)
                                    {
                                        if ("FIRST".Equals(lexer.GetStringValueUppercase()))
                                        {
                                            lexer.NextToken();
                                            stmt.AddAlterSpecification(new DdlAlterTableStatement.ModifyColumn(id,
                                                colDef, null
                                                ));
                                        }
                                        else
                                        {
                                            if ("AFTER".Equals(lexer.GetStringValueUppercase()))
                                            {
                                                lexer.NextToken();
                                                id2 = Identifier();
                                                stmt.AddAlterSpecification(new DdlAlterTableStatement.ModifyColumn(id,
                                                    colDef, id2
                                                    ));
                                            }
                                            else
                                            {
                                                stmt.AddAlterSpecification(new DdlAlterTableStatement.ModifyColumn(id,
                                                    colDef));
                                            }
                                        }
                                    }
                                    else
                                    {
                                        stmt.AddAlterSpecification(new DdlAlterTableStatement.ModifyColumn(id, colDef));
                                    }
                                    goto main_switch_break;
                                }
                            }
                        }
                        goto default;
                    }

                    default:
                    {
                        throw new SqlSyntaxErrorException("unknown ALTER specification");
                    }
                }
                main_switch_break:
                ;
            }
            return stmt;
        }
        /// <exception cref="System.SqlSyntaxErrorException" />
        private bool TableOption(DdlTableOptions options)
        {
            Identifier id = null;
            IExpression expr = null;
            switch (lexer.Token())
            {
                case MySqlToken.KwCharacter:
                {
                    lexer.NextToken();
                    Match(MySqlToken.KwSet);
                    if (lexer.Token() == MySqlToken.OpEquals)
                    {
                        lexer.NextToken();
                    }
                    id = Identifier();
                    options.CharSet = id;
                    break;
                }

                case MySqlToken.KwCollate:
                {
                    lexer.NextToken();
                    if (lexer.Token() == MySqlToken.OpEquals)
                    {
                        lexer.NextToken();
                    }
                    id = Identifier();
                    options.Collation = id;
                    break;
                }

                case MySqlToken.KwDefault:
                {
                    switch (lexer.NextToken())
                    {
                        case MySqlToken.KwCharacter:
                        {
                            // | [DEFAULT] CHARSET [=] charset_name { MySql 5.1 legacy}
                            // | [DEFAULT] CHARACTER SET [=] charset_name
                            // | [DEFAULT] COLLATE [=] collation_name
                            lexer.NextToken();
                            Match(MySqlToken.KwSet);
                            if (lexer.Token() == MySqlToken.OpEquals)
                            {
                                lexer.NextToken();
                            }
                            id = Identifier();
                            options.CharSet = id;
                            goto os_break;
                        }

                        case MySqlToken.KwCollate:
                        {
                            lexer.NextToken();
                            if (lexer.Token() == MySqlToken.OpEquals)
                            {
                                lexer.NextToken();
                            }
                            id = Identifier();
                            options.Collation = id;
                            goto os_break;
                        }

                        case MySqlToken.Identifier:
                        {
                            var si = specialIdentifiers.GetValue(lexer.GetStringValueUppercase());
                            if (si != SpecialIdentifier.None)
                            {
                                switch (si)
                                {
                                    case SpecialIdentifier.Charset:
                                    {
                                        lexer.NextToken();
                                        if (lexer.Token() == MySqlToken.OpEquals)
                                        {
                                            lexer.NextToken();
                                        }
                                        id = Identifier();
                                        options.CharSet = id;
                                        goto os_break;
                                    }
                                }
                            }
                            goto default;
                        }

                        default:
                        {
                            lexer.AddCacheToke(MySqlToken.KwDefault);
                            return false;
                        }
                    }
                    //goto case MySqlToken.KwIndex;
                }

                case MySqlToken.KwIndex:
                {
                    // | INDEX DIRECTORY [=] 'absolute path to directory'
                    lexer.NextToken();
                    if (lexer.Token() == MySqlToken.Identifier && "DIRECTORY".Equals(lexer.GetStringValueUppercase()))
                    {
                        if (lexer.NextToken() == MySqlToken.OpEquals)
                        {
                            lexer.NextToken();
                        }
                        options.IndexDir = (LiteralString)exprParser.Expression();
                        break;
                    }
                    lexer.AddCacheToke(MySqlToken.KwIndex);
                    return true;
                }

                case MySqlToken.KwUnion:
                {
                    // | UNION [=] (tbl_name[,tbl_name]...)
                    if (lexer.NextToken() == MySqlToken.OpEquals)
                    {
                        lexer.NextToken();
                    }
                    Match(MySqlToken.PuncLeftParen);
                    IList<Identifier> union = new List<Identifier>(2);
                    for (var j = 0; lexer.Token() != MySqlToken.PuncRightParen; ++j)
                    {
                        if (j > 0)
                        {
                            Match(MySqlToken.PuncComma);
                        }
                        id = Identifier();
                        union.Add(id);
                    }
                    Match(MySqlToken.PuncRightParen);
                    options.Union = union;
                    goto os_break;
                }

                case MySqlToken.Identifier:
                {
                    var si_1 = specialIdentifiers.GetValue(lexer.GetStringValueUppercase());
                    if (si_1 != SpecialIdentifier.None)
                    {
                        switch (si_1)
                        {
                            case SpecialIdentifier.Charset:
                            {
                                // CHARSET [=] charset_name
                                lexer.NextToken();
                                if (lexer.Token() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                id = Identifier();
                                options.CharSet = id;
                                goto os_break;
                            }

                            case SpecialIdentifier.Engine:
                            {
                                // ENGINE [=] engine_name
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                id = Identifier();
                                options.Engine = id;
                                goto os_break;
                            }

                            case SpecialIdentifier.AutoIncrement:
                            {
                                // | AUTO_INCREMENT [=] value
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                expr = exprParser.Expression();
                                options.AutoIncrement = expr;
                                goto os_break;
                            }

                            case SpecialIdentifier.AvgRowLength:
                            {
                                // | AVG_ROW_LENGTH [=] value
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                expr = exprParser.Expression();
                                options.AvgRowLength = expr;
                                goto os_break;
                            }

                            case SpecialIdentifier.Checksum:
                            {
                                // | CHECKSUM [=] {0 | 1}
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                switch (lexer.Token())
                                {
                                    case MySqlToken.LiteralBoolFalse:
                                    {
                                        lexer.NextToken();
                                        options.CheckSum = false;
                                        goto case MySqlToken.LiteralBoolTrue;
                                    }

                                    case MySqlToken.LiteralBoolTrue:
                                    {
                                        lexer.NextToken();
                                        options.CheckSum = true;
                                        break;
                                    }

                                    case MySqlToken.LiteralNumPureDigit:
                                    {
                                        var intVal = (int)lexer.GetIntegerValue();
                                        lexer.NextToken();
                                        if (intVal == 0)
                                        {
                                            options.CheckSum = false;
                                        }
                                        else
                                        {
                                            options.CheckSum = true;
                                        }
                                        break;
                                    }

                                    default:
                                    {
                                        throw new SqlSyntaxErrorException("table option of CHECKSUM error");
                                    }
                                }
                                goto os_break;
                            }

                            case SpecialIdentifier.DelayKeyWrite:
                            {
                                // | DELAY_KEY_WRITE [=] {0 | 1}
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                switch (lexer.Token())
                                {
                                    case MySqlToken.LiteralBoolFalse:
                                    {
                                        lexer.NextToken();
                                        options.DelayKeyWrite = false;
                                        goto case MySqlToken.LiteralBoolTrue;
                                    }

                                    case MySqlToken.LiteralBoolTrue:
                                    {
                                        lexer.NextToken();
                                        options.DelayKeyWrite = true;
                                        break;
                                    }

                                    case MySqlToken.LiteralNumPureDigit:
                                    {
                                        var intVal_1 = (int)lexer.GetIntegerValue();
                                        lexer.NextToken();
                                        if (intVal_1 == 0)
                                        {
                                            options.DelayKeyWrite = false;
                                        }
                                        else
                                        {
                                            options.DelayKeyWrite = true;
                                        }
                                        break;
                                    }

                                    default:
                                    {
                                        throw new SqlSyntaxErrorException("table option of DELAY_KEY_WRITE error");
                                    }
                                }
                                goto os_break;
                            }

                            case SpecialIdentifier.Comment:
                            {
                                // | COMMENT [=] 'string'
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.Comment = (LiteralString)exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.Connection:
                            {
                                // | CONNECTION [=] 'connect_string'
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.Connection = (LiteralString)exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.Data:
                            {
                                // | DATA DIRECTORY [=] 'absolute path to directory'
                                lexer.NextToken();
                                MatchIdentifier("DIRECTORY");
                                if (lexer.Token() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.DataDir = (LiteralString)exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.InsertMethod:
                            {
                                // | INSERT_METHOD [=] { NO | FIRST | LAST }
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                switch (MatchIdentifier("NO", "FIRST", "LAST"))
                                {
                                    case 0:
                                    {
                                        options.InsertMethod = InsertMethod.No;
                                        break;
                                    }

                                    case 1:
                                    {
                                        options.InsertMethod = InsertMethod.First;
                                        break;
                                    }

                                    case 2:
                                    {
                                        options.InsertMethod = InsertMethod.Last;
                                        break;
                                    }
                                }
                                goto os_break;
                            }

                            case SpecialIdentifier.KeyBlockSize:
                            {
                                // | KEY_BLOCK_SIZE [=] value
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.KeyBlockSize = exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.MaxRows:
                            {
                                // | MAX_ROWS [=] value
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.MaxRows = exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.MinRows:
                            {
                                // | MIN_ROWS [=] value
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.MinRows = exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.PackKeys:
                            {
                                // | PACK_KEYS [=] {0 | 1 | DEFAULT}
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                switch (lexer.Token())
                                {
                                    case MySqlToken.LiteralBoolFalse:
                                    {
                                        lexer.NextToken();
                                        options.PackKeys = PackKeys.False;
                                        break;
                                    }

                                    case MySqlToken.LiteralBoolTrue:
                                    {
                                        lexer.NextToken();
                                        options.PackKeys = PackKeys.True;
                                        break;
                                    }

                                    case MySqlToken.LiteralNumPureDigit:
                                    {
                                        var intVal_2 = (int)lexer.GetIntegerValue();
                                        lexer.NextToken();
                                        if (intVal_2 == 0)
                                        {
                                            options.PackKeys = PackKeys.False;
                                        }
                                        else
                                        {
                                            options.PackKeys = PackKeys.True;
                                        }
                                        break;
                                    }

                                    case MySqlToken.KwDefault:
                                    {
                                        lexer.NextToken();
                                        options.PackKeys = PackKeys.Default;
                                        break;
                                    }

                                    default:
                                    {
                                        throw new SqlSyntaxErrorException("table option of PACK_KEYS error");
                                    }
                                }
                                goto os_break;
                            }

                            case SpecialIdentifier.Password:
                            {
                                // | PASSWORD [=] 'string'
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                options.Password = (LiteralString)exprParser.Expression();
                                goto os_break;
                            }

                            case SpecialIdentifier.RowFormat:
                            {
                                // | ROW_FORMAT [=]
                                // {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}
                                if (lexer.NextToken() == MySqlToken.OpEquals)
                                {
                                    lexer.NextToken();
                                }
                                switch (lexer.Token())
                                {
                                    case MySqlToken.KwDefault:
                                    {
                                        lexer.NextToken();
                                        options.RowFormat = RowFormat.Default;
                                        goto os_break;
                                    }

                                    case MySqlToken.Identifier:
                                    {
                                        var sid = specialIdentifiers.GetValue(lexer.GetStringValueUppercase());
                                        if (sid != SpecialIdentifier.None)
                                        {
                                            switch (sid)
                                            {
                                                case SpecialIdentifier.Dynamic:
                                                {
                                                    lexer.NextToken();
                                                    options.RowFormat = RowFormat.Dynamic;
                                                    goto os_break;
                                                }

                                                case SpecialIdentifier.Fixed:
                                                {
                                                    lexer.NextToken();
                                                    options.RowFormat = RowFormat.Fixed;
                                                    goto os_break;
                                                }

                                                case SpecialIdentifier.Compressed:
                                                {
                                                    lexer.NextToken();
                                                    options.RowFormat = RowFormat.Compressed;
                                                    goto os_break;
                                                }

                                                case SpecialIdentifier.Redundant:
                                                {
                                                    lexer.NextToken();
                                                    options.RowFormat = RowFormat.Redundant;
                                                    goto os_break;
                                                }

                                                case SpecialIdentifier.Compact:
                                                {
                                                    lexer.NextToken();
                                                    options.RowFormat = RowFormat.Compact;
                                                    goto os_break;
                                                }
                                            }
                                        }
                                        goto default;
                                    }

                                    default:
                                    {
                                        throw new SqlSyntaxErrorException("table option of ROW_FORMAT error");
                                    }
                                }
                                //break;
                            }
                        }
                    }
                    goto default;
                }

                default:
                {
                    return false;
                }
            }
            os_break:
            ;
            return true;
        }
 /// <exception cref="System.SqlSyntaxErrorException" />
 private bool TableOptions(DdlTableOptions options)
 {
     var matched = false;
     for (var i = 0;; ++i)
     {
         var comma = false;
         if (i > 0 && lexer.Token() == MySqlToken.PuncComma)
         {
             lexer.NextToken();
             comma = true;
         }
         if (!TableOption(options))
         {
             if (comma)
             {
                 lexer.AddCacheToke(MySqlToken.PuncComma);
             }
             break;
         }
         matched = true;
     }
     return matched;
 }