/* Copyright (C) 2000-2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* sql_yacc.yy */

%{
typedef void* YYSTYPE;
#define YYSTYPE_IS_DECLARED

#include <stdio.h>
#include "myx_sql_tree_item.h"
#include "myx_lex_helpers.h"
using mysql_parser::yyerror;
using mysql_parser::yylex;
%}

%pure_parser                                    /* We have threads */
/*
  Currently there are 177 shift/reduce conflicts.
  We should not introduce new conflicts any more.
*/
%expect 167

/*
   Comments for TOKENS.
   For each token, please include in the same line a comment that contains
   the following tags:
   SQL-2003-R : Reserved keyword as per SQL-2003
   SQL-2003-N : Non Reserved keyword as per SQL-2003
   SQL-1999-R : Reserved keyword as per SQL-1999
   SQL-1999-N : Non Reserved keyword as per SQL-1999
   MYSQL      : MySQL extention (unspecified)
   MYSQL-FUNC : MySQL extention, function
   INTERNAL   : Not a real token, lex optimization
   OPERATOR   : SQL operator
   FUTURE-USE : Reserved for futur use

   This makes the code grep-able, and helps maintenance.
*/

%token  ABORT_SYM                     /* INTERNAL (used in lex) */
%token  ACCESSIBLE_SYM
%token  ACTION                        /* SQL-2003-N */
%token  ADD                           /* SQL-2003-R */
%token  ADDDATE_SYM                   /* MYSQL-FUNC */
%token  AFTER_SYM                     /* SQL-2003-N */
%token  AGAINST
%token  AGGREGATE_SYM
%token  ALGORITHM_SYM
%token  ALL                           /* SQL-2003-R */
%token  ALTER                         /* SQL-2003-R */
%token  ANALYZE_SYM
%token  AND_AND_SYM                   /* OPERATOR */
%token  AND_SYM                       /* SQL-2003-R */
%token  ANY_SYM                       /* SQL-2003-R */
%token  AS                            /* SQL-2003-R */
%token  ASC                           /* SQL-2003-N */
%token  ASCII_SYM                     /* MYSQL-FUNC */
%token  ASENSITIVE_SYM                /* FUTURE-USE */
%token  AT_SYM                        /* SQL-2003-R */
%token  AUTHORS_SYM
%token  AUTOEXTEND_SIZE_SYM
%token  AUTO_INC
%token  AVG_ROW_LENGTH
%token  AVG_SYM                       /* SQL-2003-N */
%token  BACKUP_SYM
%token  BEFORE_SYM                    /* SQL-2003-N */
%token  BEGIN_SYM                     /* SQL-2003-R */
%token  BETWEEN_SYM                   /* SQL-2003-R */
%token  BIGINT                        /* SQL-2003-R */
%token  BINARY                        /* SQL-2003-R */
%token  BINLOG_SYM
%token  BIN_NUM
%token  BIT_AND                       /* MYSQL-FUNC */
%token  BIT_OR                        /* MYSQL-FUNC */
%token  BIT_SYM                       /* MYSQL-FUNC */
%token  BIT_XOR                       /* MYSQL-FUNC */
%token  BLOB_SYM                      /* SQL-2003-R */
%token  BOOLEAN_SYM                   /* SQL-2003-R */
%token  BOOL_SYM
%token  BOTH                          /* SQL-2003-R */
%token  BTREE_SYM
%token  BY                            /* SQL-2003-R */
%token  BYTE_SYM
%token  CACHE_SYM
%token  CALL_SYM                      /* SQL-2003-R */
%token  CASCADE                       /* SQL-2003-N */
%token  CASCADED                      /* SQL-2003-R */
%token  CASE_SYM                      /* SQL-2003-R */
%token  CAST_SYM                      /* SQL-2003-R */
%token  CHAIN_SYM                     /* SQL-2003-N */
%token  CHANGE
%token  CHANGED
%token  CHARSET
%token  CHAR_SYM                      /* SQL-2003-R */
%token  CHECKSUM_SYM
%token  CHECK_SYM                     /* SQL-2003-R */
%token  CIPHER_SYM
%token  CLIENT_SYM
%token  CLOSE_SYM                     /* SQL-2003-R */
%token  COALESCE                      /* SQL-2003-N */
%token  CODE_SYM
%token  COLLATE_SYM                   /* SQL-2003-R */
%token  COLLATION_SYM                 /* SQL-2003-N */
%token  COLUMNS
%token  COLUMN_SYM                    /* SQL-2003-R */
%token  COMMENT_SYM
%token  COMMITTED_SYM                 /* SQL-2003-N */
%token  COMMIT_SYM                    /* SQL-2003-R */
%token  COMPACT_SYM
%token  COMPLETION_SYM
%token  COMPRESSED_SYM
%token  CONCURRENT
%token  CONDITION_SYM                 /* SQL-2003-N */
%token  CONNECTION_SYM
%token  CONSISTENT_SYM
%token  CONSTRAINT                    /* SQL-2003-R */
%token  CONTAINS_SYM                  /* SQL-2003-N */
%token  CONTINUE_SYM                  /* SQL-2003-R */
%token  CONTRIBUTORS_SYM
%token  CONVERT_SYM                   /* SQL-2003-N */
%token  COUNT_SYM                     /* SQL-2003-N */
%token  CREATE                        /* SQL-2003-R */
%token  CROSS                         /* SQL-2003-R */
%token  CUBE_SYM                      /* SQL-2003-R */
%token  CURDATE                       /* MYSQL-FUNC */
%token  CURRENT_USER                  /* SQL-2003-R */
%token  CURSOR_SYM                    /* SQL-2003-R */
%token  CURTIME                       /* MYSQL-FUNC */
%token  DATABASE
%token  DATABASES
%token  DATAFILE_SYM
%token  DATA_SYM                      /* SQL-2003-N */
%token  DATETIME
%token  DATE_ADD_INTERVAL             /* MYSQL-FUNC */
%token  DATE_SUB_INTERVAL             /* MYSQL-FUNC */
%token  DATE_SYM                      /* SQL-2003-R */
%token  DAY_HOUR_SYM
%token  DAY_MICROSECOND_SYM
%token  DAY_MINUTE_SYM
%token  DAY_SECOND_SYM
%token  DAY_SYM                       /* SQL-2003-R */
%token  DEALLOCATE_SYM                /* SQL-2003-R */
%token  DECIMAL_NUM
%token  DECIMAL_SYM                   /* SQL-2003-R */
%token  DECLARE_SYM                   /* SQL-2003-R */
%token  DEFAULT                       /* SQL-2003-R */
%token  DEFINER_SYM
%token  DELAYED_SYM
%token  DELAY_KEY_WRITE_SYM
%token  DELETE_SYM                    /* SQL-2003-R */
%token  DESC                          /* SQL-2003-N */
%token  DESCRIBE                      /* SQL-2003-R */
%token  DES_KEY_FILE
%token  DETERMINISTIC_SYM             /* SQL-2003-R */
%token  DIRECTORY_SYM
%token  DISABLE_SYM
%token  DISCARD
%token  DISK_SYM
%token  DISTINCT                      /* SQL-2003-R */
%token  DIV_SYM
%token  DOUBLE_SYM                    /* SQL-2003-R */
%token  DO_SYM
%token  DROP                          /* SQL-2003-R */
%token  DUAL_SYM
%token  DUMPFILE
%token  DUPLICATE_SYM
%token  DYNAMIC_SYM                   /* SQL-2003-R */
%token  EACH_SYM                      /* SQL-2003-R */
%token  EDIT_SYM
%token  ELSE                          /* SQL-2003-R */
%token  ELSEIF_SYM
%token  ENABLE_SYM
%token  ENCLOSED
%token  END                           /* SQL-2003-R */
%token  ENDS_SYM
%token  END_OF_INPUT                  /* INTERNAL */
%token  ENGINES_SYM
%token  ENGINE_SYM
%token  ENUM
%token  EQ                            /* OPERATOR */
%token  EQUAL_SYM                     /* OPERATOR */
%token  ERRORS
%token  ESCAPED
%token  ESCAPE_SYM                    /* SQL-2003-R */
%token  EVENTS_SYM
%token  EVENT_SYM
%token  EVERY_SYM                     /* SQL-2003-N */
%token  EXECUTE_SYM                   /* SQL-2003-R */
%token  EXISTS                        /* SQL-2003-R */
%token  EXIT_SYM
%token  EXPANSION_SYM
%token  EXTENDED_SYM
%token  EXTENT_SIZE_SYM
%token  EXTRACT_SYM                   /* SQL-2003-N */
%token  FALSE_SYM                     /* SQL-2003-R */
%token  FAST_SYM
%token  FETCH_SYM                     /* SQL-2003-R */
%token  FILE_SYM
%token  FIRST_SYM                     /* SQL-2003-N */
%token  FIXED_SYM
%token  FLOAT_NUM
%token  FLOAT_SYM                     /* SQL-2003-R */
%token  FLUSH_SYM
%token  FORCE_SYM
%token  FOREIGN                       /* SQL-2003-R */
%token  FOR_SYM                       /* SQL-2003-R */
%token  FOUND_SYM                     /* SQL-2003-R */
%token  FRAC_SECOND_SYM
%token  FROM
%token  FULL                          /* SQL-2003-R */
%token  FULLTEXT_SYM
%token  FUNCTION_SYM                  /* SQL-2003-R */
%token  GE
%token  GEOMETRYCOLLECTION
%token  GEOMETRY_SYM
%token  GET_FORMAT                    /* MYSQL-FUNC */
%token  GLOBAL_SYM                    /* SQL-2003-R */
%token  GRANT                         /* SQL-2003-R */
%token  GRANTS
%token  GROUP_SYM                     /* SQL-2003-R */
%token  GROUP_CONCAT_SYM
%token  GT_SYM                        /* OPERATOR */
%token  HANDLER_SYM
%token  HASH_SYM
%token  HAVING                        /* SQL-2003-R */
%token  HELP_SYM
%token  HEX_NUM
%token  HIGH_PRIORITY
%token  HOST_SYM
%token  HOSTS_SYM
%token  HOUR_MICROSECOND_SYM
%token  HOUR_MINUTE_SYM
%token  HOUR_SECOND_SYM
%token  HOUR_SYM                      /* SQL-2003-R */
%token  IDENT
%token  IDENTIFIED_SYM
%token  IDENT_QUOTED
%token  IF
%token  IGNORE_SYM
%token  IMPORT
%token  INDEXES
%token  INDEX_SYM
%token  INFILE
%token  INITIAL_SIZE_SYM
%token  INNER_SYM                     /* SQL-2003-R */
%token  INNOBASE_SYM
%token  INOUT_SYM                     /* SQL-2003-R */
%token  INSENSITIVE_SYM               /* SQL-2003-R */
%token  INSERT                        /* SQL-2003-R */
%token  INSERT_METHOD
%token  INSTALL_SYM
%token  INTERVAL_SYM                  /* SQL-2003-R */
%token  INTO                          /* SQL-2003-R */
%token  INT_SYM                       /* SQL-2003-R */
%token  INVOKER_SYM
%token  IN_SYM                        /* SQL-2003-R */
%token  IS                            /* SQL-2003-R */
%token  ISOLATION                     /* SQL-2003-R */
%token  ISSUER_SYM
%token  ITERATE_SYM
%token  JOIN_SYM                      /* SQL-2003-R */
%token  KEYS
%token  KEY_BLOCK_SIZE
%token  KEY_SYM                       /* SQL-2003-N */
%token  KILL_SYM
%token  LANGUAGE_SYM                  /* SQL-2003-R */
%token  LAST_SYM                      /* SQL-2003-N */
%token  LE                            /* OPERATOR */
%token  LEADING                       /* SQL-2003-R */
%token  LEAVES
%token  LEAVE_SYM
%token  LEFT                          /* SQL-2003-R */
%token  LESS_SYM
%token  LEVEL_SYM
%token  LEX_HOSTNAME
%token  LIKE                          /* SQL-2003-R */
%token  LIMIT
%token  LINEAR_SYM
%token  LINES
%token  LINESTRING
%token  LIST_SYM
%token  LOAD
%token  LOCAL_SYM                     /* SQL-2003-R */
%token  LOCATOR_SYM                   /* SQL-2003-N */
%token  LOCKS_SYM
%token  LOCK_SYM
%token  LOGFILE_SYM
%token  LOGS_SYM
%token  LONGBLOB
%token  LONGTEXT
%token  LONG_NUM
%token  LONG_SYM
%token  LOOP_SYM
%token  LOW_PRIORITY
%token  LT                            /* OPERATOR */
%token  MASTER_CONNECT_RETRY_SYM
%token  MASTER_HOST_SYM
%token  MASTER_LOG_FILE_SYM
%token  MASTER_LOG_POS_SYM
%token  MASTER_PASSWORD_SYM
%token  MASTER_PORT_SYM
%token  MASTER_SERVER_ID_SYM
%token  MASTER_SSL_CAPATH_SYM
%token  MASTER_SSL_CA_SYM
%token  MASTER_SSL_CERT_SYM
%token  MASTER_SSL_CIPHER_SYM
%token  MASTER_SSL_KEY_SYM
%token  MASTER_SSL_SYM
%token  MASTER_SSL_VERIFY_SERVER_CERT_SYM
%token  MASTER_SYM
%token  MASTER_USER_SYM
%token  MATCH                         /* SQL-2003-R */
%token  MAX_CONNECTIONS_PER_HOUR
%token  MAX_QUERIES_PER_HOUR
%token  MAX_ROWS
%token  MAX_SIZE_SYM
%token  MAX_SYM                       /* SQL-2003-N */
%token  MAX_UPDATES_PER_HOUR
%token  MAX_USER_CONNECTIONS_SYM
%token  MAX_VALUE_SYM                 /* SQL-2003-N */
%token  MEDIUMBLOB
%token  MEDIUMINT
%token  MEDIUMTEXT
%token  MEDIUM_SYM
%token  MEMORY_SYM
%token  MERGE_SYM                     /* SQL-2003-R */
%token  MICROSECOND_SYM               /* MYSQL-FUNC */
%token  MIGRATE_SYM
%token  MINUTE_MICROSECOND_SYM
%token  MINUTE_SECOND_SYM
%token  MINUTE_SYM                    /* SQL-2003-R */
%token  MIN_ROWS
%token  MIN_SYM                       /* SQL-2003-N */
%token  MODE_SYM
%token  MODIFIES_SYM                  /* SQL-2003-R */
%token  MODIFY_SYM
%token  MOD_SYM                       /* SQL-2003-N */
%token  MONTH_SYM                     /* SQL-2003-R */
%token  MULTILINESTRING
%token  MULTIPOINT
%token  MULTIPOLYGON
%token  MUTEX_SYM
%token  NAMES_SYM                     /* SQL-2003-N */
%token  NAME_SYM                      /* SQL-2003-N */
%token  NATIONAL_SYM                  /* SQL-2003-R */
%token  NATURAL                       /* SQL-2003-R */
%token  NCHAR_STRING
%token  NCHAR_SYM                     /* SQL-2003-R */
%token  NDBCLUSTER_SYM
%token  NE                            /* OPERATOR */
%token  NEG
%token  NEW_SYM                       /* SQL-2003-R */
%token  NEXT_SYM                      /* SQL-2003-N */
%token  NODEGROUP_SYM
%token  NONE_SYM                      /* SQL-2003-R */
%token  NOT2_SYM
%token  NOT_SYM                       /* SQL-2003-R */
%token  NOW_SYM
%token  NO_SYM                        /* SQL-2003-R */
%token  NO_WAIT_SYM
%token  NO_WRITE_TO_BINLOG
%token  NULL_SYM                      /* SQL-2003-R */
%token  NUM
%token  NUMERIC_SYM                   /* SQL-2003-R */
%token  NVARCHAR_SYM
%token  OFFSET_SYM
%token  OLD_PASSWORD
%token  ON                            /* SQL-2003-R */
%token  ONE_SHOT_SYM
%token  ONE_SYM
%token  OPEN_SYM                      /* SQL-2003-R */
%token  OPTIMIZE
%token  OPTIONS_SYM
%token  OPTION                        /* SQL-2003-N */
%token  OPTIONALLY
%token  OR2_SYM
%token  ORDER_SYM                     /* SQL-2003-R */
%token  OR_OR_SYM                     /* OPERATOR */
%token  OR_SYM                        /* SQL-2003-R */
%token  OUTER
%token  OUTFILE
%token  OUT_SYM                       /* SQL-2003-R */
%token  OWNER_SYM
%token  PACK_KEYS_SYM
%token  PAGE_SYM
%token  PARAM_MARKER
%token  PARSER_SYM
%token  PARTIAL                       /* SQL-2003-N */
%token  PARTITIONING_SYM
%token  PARTITIONS_SYM
%token  PARTITION_SYM                 /* SQL-2003-R */
%token  PASSWORD
%token  PHASE_SYM
%token  PLUGINS_SYM
%token  PLUGIN_SYM
%token  POINT_SYM
%token  POLYGON
%token  PORT_SYM
%token  POSITION_SYM                  /* SQL-2003-N */
%token  PRECISION                     /* SQL-2003-R */
%token  PREPARE_SYM                   /* SQL-2003-R */
%token  PRESERVE_SYM
%token  PREV_SYM
%token  PRIMARY_SYM                   /* SQL-2003-R */
%token  PRIVILEGES                    /* SQL-2003-N */
%token  PROCEDURE                     /* SQL-2003-R */
%token  PROCESS
%token  PROCESSLIST_SYM
%token  PURGE
%token  QUARTER_SYM
%token  QUERY_SYM
%token  QUICK
%token  RANGE_SYM                     /* SQL-2003-R */
%token  READS_SYM                     /* SQL-2003-R */
%token  READ_ONLY_SYM
%token  READ_SYM                      /* SQL-2003-N */
%token  READ_WRITE_SYM
%token  REAL                          /* SQL-2003-R */
%token  REBUILD_SYM
%token  RECOVER_SYM
%token  REDOFILE_SYM
%token  REDO_BUFFER_SIZE_SYM
%token  REDUNDANT_SYM
%token  REFERENCES                    /* SQL-2003-R */
%token  REGEXP
%token  RELAY_LOG_FILE_SYM
%token  RELAY_LOG_POS_SYM
%token  RELAY_THREAD
%token  RELEASE_SYM                   /* SQL-2003-R */
%token  RELOAD
%token  REMOVE_SYM
%token  RENAME
%token  REORGANIZE_SYM
%token  REPAIR
%token  REPEATABLE_SYM                /* SQL-2003-N */
%token  REPEAT_SYM                    /* MYSQL-FUNC */
%token  REPLACE                       /* MYSQL-FUNC */
%token  REPLICATION
%token  REQUIRE_SYM
%token  RESET_SYM
%token  RESOURCES
%token  RESTORE_SYM
%token  RESTRICT
%token  RESUME_SYM
%token  RETURNS_SYM                   /* SQL-2003-R */
%token  RETURN_SYM                    /* SQL-2003-R */
%token  REVOKE                        /* SQL-2003-R */
%token  RIGHT                         /* SQL-2003-R */
%token  ROLLBACK_SYM                  /* SQL-2003-R */
%token  ROLLUP_SYM                    /* SQL-2003-R */
%token  ROUTINE_SYM                   /* SQL-2003-N */
%token  ROWS_SYM                      /* SQL-2003-R */
%token  ROW_FORMAT_SYM
%token  ROW_SYM                       /* SQL-2003-R */
%token  RTREE_SYM
%token  SAVEPOINT_SYM                 /* SQL-2003-R */
%token  SCHEDULE_SYM
%token  SECOND_MICROSECOND_SYM
%token  SECOND_SYM                    /* SQL-2003-R */
%token  SECURITY_SYM                  /* SQL-2003-N */
%token  SELECT_SYM                    /* SQL-2003-R */
%token  SENSITIVE_SYM                 /* FUTURE-USE */
%token  SEPARATOR_SYM
%token  SERIALIZABLE_SYM              /* SQL-2003-N */
%token  SERIAL_SYM
%token  SESSION_SYM                   /* SQL-2003-N */
%token  SERVER_SYM
%token  SERVER_OPTIONS
%token  SET                           /* SQL-2003-R */
%token  SET_VAR
%token  SHARE_SYM
%token  SHIFT_LEFT                    /* OPERATOR */
%token  SHIFT_RIGHT                   /* OPERATOR */
%token  SHOW
%token  SHUTDOWN
%token  SIGNED_SYM
%token  SIMPLE_SYM                    /* SQL-2003-N */
%token  SLAVE
%token  SMALLINT                      /* SQL-2003-R */
%token  SNAPSHOT_SYM
%token  SOCKET_SYM
%token  SONAME_SYM
%token  SOUNDS_SYM
%token  SPATIAL_SYM
%token  SPECIFIC_SYM                  /* SQL-2003-R */
%token  SQLEXCEPTION_SYM              /* SQL-2003-R */
%token  SQLSTATE_SYM                  /* SQL-2003-R */
%token  SQLWARNING_SYM                /* SQL-2003-R */
%token  SQL_BIG_RESULT
%token  SQL_BUFFER_RESULT
%token  SQL_CACHE_SYM
%token  SQL_CALC_FOUND_ROWS
%token  SQL_NO_CACHE_SYM
%token  SQL_SMALL_RESULT
%token  SQL_SYM                       /* SQL-2003-R */
%token  SQL_THREAD
%token  SSL_SYM
%token  STARTING
%token  STARTS_SYM
%token  START_SYM                     /* SQL-2003-R */
%token  STATUS_SYM
%token  STDDEV_SAMP_SYM               /* SQL-2003-N */
%token  STD_SYM
%token  STOP_SYM
%token  STORAGE_SYM
%token  STRAIGHT_JOIN
%token  STRING_SYM
%token  SUBDATE_SYM
%token  SUBJECT_SYM
%token  SUBPARTITIONS_SYM
%token  SUBPARTITION_SYM
%token  SUBSTRING                     /* SQL-2003-N */
%token  SUM_SYM                       /* SQL-2003-N */
%token  SUPER_SYM
%token  SUSPEND_SYM
%token  SYSDATE
%token  TABLES
%token  TABLESPACE
%token  TABLE_REF_PRIORITY
%token  TABLE_SYM                     /* SQL-2003-R */
%token  TEMPORARY                     /* SQL-2003-N */
%token  TEMPTABLE_SYM
%token  TERMINATED
%token  TEXT_STRING
%token  TEXT_SYM
%token  THAN_SYM
%token  THEN_SYM                      /* SQL-2003-R */
%token  TIMESTAMP                     /* SQL-2003-R */
%token  TIMESTAMP_ADD
%token  TIMESTAMP_DIFF
%token  TIME_SYM                      /* SQL-2003-R */
%token  TINYBLOB
%token  TINYINT
%token  TINYTEXT
%token  TO_SYM                        /* SQL-2003-R */
%token  TRAILING                      /* SQL-2003-R */
%token  TRANSACTION_SYM
%token  TRANSACTIONAL_SYM
%token  TRIGGERS_SYM
%token  TRIGGER_SYM                   /* SQL-2003-R */
%token  TRIM                          /* SQL-2003-N */
%token  TRUE_SYM                      /* SQL-2003-R */
%token  TRUNCATE_SYM
%token  TYPES_SYM
%token  TYPE_SYM                      /* SQL-2003-N */
%token  UDF_RETURNS_SYM
%token  ULONGLONG_NUM
%token  UNCOMMITTED_SYM               /* SQL-2003-N */
%token  UNDEFINED_SYM
%token  UNDERSCORE_CHARSET
%token  UNDOFILE_SYM
%token  UNDO_BUFFER_SIZE_SYM
%token  UNDO_SYM                      /* FUTURE-USE */
%token  UNICODE_SYM
%token  UNINSTALL_SYM
%token  UNION_SYM                     /* SQL-2003-R */
%token  UNIQUE_SYM
%token  UNKNOWN_SYM                   /* SQL-2003-R */
%token  UNLOCK_SYM
%token  UNSIGNED
%token  UNTIL_SYM
%token  UPDATE_SYM                    /* SQL-2003-R */
%token  UPGRADE_SYM
%token  USAGE                         /* SQL-2003-N */
%token  USER                          /* SQL-2003-R */
%token  USE_FRM
%token  USE_SYM
%token  USING                         /* SQL-2003-R */
%token  UTC_DATE_SYM
%token  UTC_TIMESTAMP_SYM
%token  UTC_TIME_SYM
%token  VALUES                        /* SQL-2003-R */
%token  VALUE_SYM                     /* SQL-2003-R */
%token  VARBINARY
%token  VARCHAR                       /* SQL-2003-R */
%token  VARIABLES
%token  VARIANCE_SYM
%token  VARYING                       /* SQL-2003-R */
%token  VAR_SAMP_SYM
%token  VIEW_SYM                      /* SQL-2003-N */
%token  WAIT_SYM
%token  WARNINGS
%token  WEEK_SYM
%token  WHEN_SYM                      /* SQL-2003-R */
%token  WHERE                         /* SQL-2003-R */
%token  WHILE_SYM
%token  WITH                          /* SQL-2003-R */
%token  WORK_SYM                      /* SQL-2003-N */
%token  WRAPPER_SYM
%token  WRITE_SYM                     /* SQL-2003-N */
%token  X509_SYM
%token  XA_SYM
%token  XOR
%token  YEAR_MONTH_SYM
%token  YEAR_SYM                      /* SQL-2003-R */
%token  ZEROFILL

%left   JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
/* A dummy token to force the priority of table_ref production in a join. */
%left   TABLE_REF_PRIORITY
%left   SET_VAR
%left   OR_OR_SYM OR_SYM OR2_SYM
%left   XOR
%left   AND_SYM AND_AND_SYM
%left   BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
%left   EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
%left   '|'
%left   '&'
%left   SHIFT_LEFT SHIFT_RIGHT
%left   '-' '+'
%left   '*' '/' '%' DIV_SYM MOD_SYM
%left   '^'
%left   NEG '~'
%right  NOT_SYM NOT2_SYM
%right  BINARY COLLATE_SYM
%left  INTERVAL_SYM

%%

query:
      END_OF_INPUT
      {
        $$= NULL;
        mysql_parser::MyxSQLTreeItem::tree((mysql_parser::MyxSQLTreeItem*) $$);
      }
    | verb_clause END_OF_INPUT
      {
        $$= $1;
        mysql_parser::MyxSQLTreeItem::tree((mysql_parser::MyxSQLTreeItem*) $$);
      }
    ;

verb_clause:
      statement
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_verb_clause, "", p);
      }
    | begin
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_verb_clause, "", p);
      }
    | verb_clause ';'
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_59));
        $$= mysql_parser::tree_item_reuse($1, sql::_verb_clause, p);
      }
    ;

statement:
      alter
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | analyze
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | backup
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | binlog_base64_event
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | call
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | change
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | check
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | checksum
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | commit
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | create
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | deallocate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | delete
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | describe
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | do
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | drop
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | edit
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | execute
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | flush
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | grant
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | handler
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | help
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | insert
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | install
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | kill
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | load
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | lock
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | optimize
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | keycache
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | partition_entry
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | preload
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | prepare
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | purge
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | release
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | rename
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | repair
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | replace
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | reset
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | restore
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | revoke
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | rollback
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | savepoint
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | select
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | set
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | show
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | slave
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | start
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | truncate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | uninstall
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | unlock
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | update
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | use
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    | xa
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_statement, "", p);
      }
    ;

deallocate:
      deallocate_or_drop PREPARE_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PREPARE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_deallocate, "", p);
      }
    ;

deallocate_or_drop:
      DEALLOCATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_deallocate_or_drop);
      }
    | DROP
      {
        $$= mysql_parser::set_item_name($1, sql::_deallocate_or_drop);
      }
    ;

prepare:
      PREPARE_SYM ident FROM prepare_src
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PREPARE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_prepare, "", p);
      }
    ;

prepare_src:
      TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_prepare_src, "", p);
      }
    | '@' ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_prepare_src, "", p);
      }
    ;

edit:
      EDIT_SYM table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EDIT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_edit, "", p);
      }
    ;

execute:
      EXECUTE_SYM ident execute_using
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EXECUTE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_execute, "", p);
      }
    ;

execute_using:
      /* empty */
      {
        $$= NULL;
      }
    | USING execute_var_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USING));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_execute_using, "", p);
      }
    ;

execute_var_list:
      execute_var_list ',' execute_var_ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_execute_var_list, p);
      }
    | execute_var_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_execute_var_list, "", p);
      }
    ;

execute_var_ident:
      '@' ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_execute_var_ident, "", p);
      }
    ;

help:
      HELP_SYM ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HELP_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_help, "", p);
      }
    ;

change:
      CHANGE MASTER_SYM TO_SYM master_defs
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHANGE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MASTER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_change, "", p);
      }
    ;

master_defs:
      master_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_master_defs, "", p);
      }
    | master_defs ',' master_def
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_master_defs, p);
      }
    ;

master_def:
      MASTER_HOST_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_HOST_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_USER_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_USER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_PASSWORD_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_PORT_SYM EQ ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_PORT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_CONNECT_RETRY_SYM EQ ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_CONNECT_RETRY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_SYM EQ ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_CA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_CAPATH_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_CERT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_CIPHER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_KEY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SSL_VERIFY_SERVER_CERT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    | master_file_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_master_def, "", p);
      }
    ;

master_file_def:
      MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_LOG_FILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_file_def, "", p);
      }
    | MASTER_LOG_POS_SYM EQ ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_LOG_POS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_file_def, "", p);
      }
    | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RELAY_LOG_FILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_file_def, "", p);
      }
    | RELAY_LOG_POS_SYM EQ ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RELAY_LOG_POS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_master_file_def, "", p);
      }
    ;

create:
      CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident create2
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON table_ident '(' key_list ')' key_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INDEX_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_ON));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_40));
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($10, sql::_41));
        mysql_parser::tree_item_list_add(p, $11);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE DATABASE opt_if_not_exists ident opt_create_database_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE view_or_trigger_or_sp_or_event
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE USER clear_privileges grant_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_USER));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE LOGFILE_SYM GROUP_SYM logfile_group_info
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOGFILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_GROUP_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE TABLESPACE tablespace_info
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    | CREATE server_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_create, "", p);
      }
    ;

server_def:
      SERVER_SYM ident_or_text FOREIGN DATA_SYM WRAPPER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SERVER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FOREIGN));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_DATA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_WRAPPER_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_OPTIONS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_40));
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($10, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_server_def, "", p);
      }
    ;

server_options_list:
      server_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_server_options_list, "", p);
      }
    | server_options_list ',' server_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_server_options_list, p);
      }
    ;

server_option:
      USER TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USER));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    | HOST_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HOST_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    | DATABASE TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    | OWNER_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OWNER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    | PASSWORD TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    | SOCKET_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SOCKET_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    | PORT_SYM ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PORT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_server_option, "", p);
      }
    ;

event_tail:
      EVENT_SYM opt_if_not_exists sp_name ON SCHEDULE_SYM ev_schedule_time opt_ev_on_completion opt_ev_status opt_ev_comment DO_SYM ev_sql_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EVENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_SCHEDULE_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($10, sql::_DO_SYM));
        mysql_parser::tree_item_list_add(p, $11);
        $$= mysql_parser::new_tree_item(sql::_event_tail, "", p);
      }
    ;

ev_schedule_time:
      EVERY_SYM expr interval ev_starts ev_ends
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EVERY_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_ev_schedule_time, "", p);
      }
    | AT_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_ev_schedule_time, "", p);
      }
    ;

opt_ev_status:
      /* empty */
      {
        $$= NULL;
      }
    | ENABLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENABLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_ev_status, "", p);
      }
    | DISABLE_SYM ON SLAVE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DISABLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_SLAVE));
        $$= mysql_parser::new_tree_item(sql::_opt_ev_status, "", p);
      }
    | DISABLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DISABLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_ev_status, "", p);
      }
    ;

ev_starts:
      /* empty */
      {
        $$= NULL;
      }
    | STARTS_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STARTS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_ev_starts, "", p);
      }
    ;

ev_ends:
      /* empty */
      {
        $$= NULL;
      }
    | ENDS_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENDS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_ev_ends, "", p);
      }
    ;

opt_ev_on_completion:
      /* empty */
      {
        $$= NULL;
      }
    | ev_on_completion
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_ev_on_completion, "", p);
      }
    ;

ev_on_completion:
      ON COMPLETION_SYM PRESERVE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COMPLETION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_PRESERVE_SYM));
        $$= mysql_parser::new_tree_item(sql::_ev_on_completion, "", p);
      }
    | ON COMPLETION_SYM NOT_SYM PRESERVE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COMPLETION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NOT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_PRESERVE_SYM));
        $$= mysql_parser::new_tree_item(sql::_ev_on_completion, "", p);
      }
    ;

opt_ev_comment:
      /* empty */
      {
        $$= NULL;
      }
    | COMMENT_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_ev_comment, "", p);
      }
    ;

ev_sql_stmt:
      ev_sql_stmt_inner
      {
        $$= mysql_parser::set_item_name($1, sql::_ev_sql_stmt);
      }
    ;

ev_sql_stmt_inner:
      sp_proc_stmt_statement
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_return
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_if
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | case_stmt_specification
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_labeled_control
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_unlabeled
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_leave
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_iterate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_open
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_fetch
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    | sp_proc_stmt_close
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_sql_stmt_inner, "", p);
      }
    ;

clear_privileges:
      /* empty */
      {
        $$= NULL;
      }
    ;

sp_name:
      ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_sp_name, "", p);
      }
    | ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_name, "", p);
      }
    ;

sp_a_chistics:
      /* empty */
      {
        $$= NULL;
      }
    | sp_a_chistics sp_chistic
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_a_chistics, p);
      }
    ;

sp_c_chistics:
      /* empty */
      {
        $$= NULL;
      }
    | sp_c_chistics sp_c_chistic
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_c_chistics, p);
      }
    ;

sp_chistic:
      COMMENT_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    | LANGUAGE_SYM SQL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LANGUAGE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SQL_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    | NO_SYM SQL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NO_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SQL_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    | CONTAINS_SYM SQL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONTAINS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SQL_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    | READS_SYM SQL_SYM DATA_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SQL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DATA_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    | MODIFIES_SYM SQL_SYM DATA_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MODIFIES_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SQL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DATA_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    | sp_suid
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_chistic, "", p);
      }
    ;

sp_c_chistic:
      sp_chistic
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_c_chistic, "", p);
      }
    | DETERMINISTIC_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DETERMINISTIC_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_c_chistic, "", p);
      }
    | not DETERMINISTIC_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DETERMINISTIC_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_c_chistic, "", p);
      }
    ;

sp_suid:
      SQL_SYM SECURITY_SYM DEFINER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SECURITY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DEFINER_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_suid, "", p);
      }
    | SQL_SYM SECURITY_SYM INVOKER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SECURITY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INVOKER_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_suid, "", p);
      }
    ;

call:
      CALL_SYM sp_name opt_sp_cparam_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CALL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_call, "", p);
      }
    ;

opt_sp_cparam_list:
      /* empty */
      {
        $$= NULL;
      }
    | '(' opt_sp_cparams ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_sp_cparam_list, "", p);
      }
    ;

opt_sp_cparams:
      /* empty */
      {
        $$= NULL;
      }
    | sp_cparams
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_sp_cparams, "", p);
      }
    ;

sp_cparams:
      sp_cparams ',' expr
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_cparams, p);
      }
    | expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_cparams, "", p);
      }
    ;

sp_fdparam_list:
      /* empty */
      {
        $$= NULL;
      }
    | sp_fdparams
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_fdparam_list, "", p);
      }
    ;

sp_fdparams:
      sp_fdparams ',' sp_fdparam
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_fdparams, p);
      }
    | sp_fdparam
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_fdparams, "", p);
      }
    ;

sp_init_param:
      /* empty */
      {
        $$= NULL;
      }
    ;

sp_fdparam:
      ident sp_init_param type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_sp_fdparam, "", p);
      }
    ;

sp_pdparam_list:
      /* empty */
      {
        $$= NULL;
      }
    | sp_pdparams
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_pdparam_list, "", p);
      }
    ;

sp_pdparams:
      sp_pdparams ',' sp_pdparam
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_pdparams, p);
      }
    | sp_pdparam
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_pdparams, "", p);
      }
    ;

sp_pdparam:
      sp_opt_inout sp_init_param ident type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_sp_pdparam, "", p);
      }
    ;

sp_opt_inout:
      /* empty */
      {
        $$= NULL;
      }
    | IN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_opt_inout);
      }
    | OUT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_opt_inout);
      }
    | INOUT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_opt_inout);
      }
    ;

sp_proc_stmts:
      /* empty */
      {
        $$= NULL;
      }
    | sp_proc_stmts sp_proc_stmt ';'
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_59));
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_proc_stmts, p);
      }
    ;

sp_proc_stmts1:
      sp_proc_stmt ';'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_59));
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmts1, "", p);
      }
    | sp_proc_stmts1 sp_proc_stmt ';'
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_59));
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_proc_stmts1, p);
      }
    ;

sp_decls:
      /* empty */
      {
        $$= NULL;
      }
    | sp_decls sp_decl ';'
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_59));
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_decls, p);
      }
    ;

sp_decl:
      DECLARE_SYM sp_decl_idents type sp_opt_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DECLARE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_sp_decl, "", p);
      }
    | DECLARE_SYM ident CONDITION_SYM FOR_SYM sp_cond
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DECLARE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_CONDITION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_sp_decl, "", p);
      }
    | DECLARE_SYM sp_handler_type HANDLER_SYM FOR_SYM sp_hcond_list sp_proc_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DECLARE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_HANDLER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_sp_decl, "", p);
      }
    | DECLARE_SYM ident CURSOR_SYM FOR_SYM sp_cursor_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DECLARE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_CURSOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_sp_decl, "", p);
      }
    ;

sp_cursor_stmt:
      select
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_cursor_stmt);
      }
    ;

sp_handler_type:
      EXIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_handler_type);
      }
    | CONTINUE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_handler_type);
      }
    ;

sp_hcond_list:
      sp_hcond_element
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_hcond_list, "", p);
      }
    | sp_hcond_list ',' sp_hcond_element
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_hcond_list, p);
      }
    ;

sp_hcond_element:
      sp_hcond
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_hcond_element, "", p);
      }
    ;

sp_cond:
      ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_cond, "", p);
      }
    | SQLSTATE_SYM opt_value TEXT_STRING_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQLSTATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_sp_cond, "", p);
      }
    ;

opt_value:
      /* empty */
      {
        $$= NULL;
      }
    | VALUE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_value);
      }
    ;

sp_hcond:
      sp_cond
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_hcond, "", p);
      }
    | ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_hcond, "", p);
      }
    | SQLWARNING_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQLWARNING_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_hcond, "", p);
      }
    | not FOUND_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FOUND_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_hcond, "", p);
      }
    | SQLEXCEPTION_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQLEXCEPTION_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_hcond, "", p);
      }
    ;

sp_decl_idents:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_decl_idents, "", p);
      }
    | sp_decl_idents ',' ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_decl_idents, p);
      }
    ;

sp_opt_default:
      /* empty */
      {
        $$= NULL;
      }
    | DEFAULT expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFAULT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_opt_default, "", p);
      }
    ;

sp_proc_stmt:
      sp_proc_stmt_statement
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_return
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_if
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | case_stmt_specification
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_labeled_control
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_unlabeled
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_leave
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_iterate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_open
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_fetch
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    | sp_proc_stmt_close
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt, "", p);
      }
    ;

sp_proc_stmt_if:
      IF sp_if END IF
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IF));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_END));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_IF));
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_if, "", p);
      }
    ;

sp_proc_stmt_statement:
      statement
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_proc_stmt_statement);
      }
    ;

sp_proc_stmt_return:
      RETURN_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RETURN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_return, "", p);
      }
    ;

sp_proc_stmt_unlabeled:
      sp_unlabeled_control
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_unlabeled, "", p);
      }
    ;

sp_proc_stmt_leave:
      LEAVE_SYM label_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LEAVE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_leave, "", p);
      }
    ;

sp_proc_stmt_iterate:
      ITERATE_SYM label_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ITERATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_iterate, "", p);
      }
    ;

sp_proc_stmt_open:
      OPEN_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OPEN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_open, "", p);
      }
    ;

sp_proc_stmt_fetch:
      FETCH_SYM sp_opt_fetch_noise ident INTO sp_fetch_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FETCH_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_INTO));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_fetch, "", p);
      }
    ;

sp_proc_stmt_close:
      CLOSE_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CLOSE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_proc_stmt_close, "", p);
      }
    ;

sp_opt_fetch_noise:
      /* empty */
      {
        $$= NULL;
      }
    | NEXT_SYM FROM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NEXT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FROM));
        $$= mysql_parser::new_tree_item(sql::_sp_opt_fetch_noise, "", p);
      }
    | FROM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        $$= mysql_parser::new_tree_item(sql::_sp_opt_fetch_noise, "", p);
      }
    ;

sp_fetch_list:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sp_fetch_list, "", p);
      }
    | sp_fetch_list ',' ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sp_fetch_list, p);
      }
    ;

sp_if:
      expr THEN_SYM sp_proc_stmts1 sp_elseifs
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_THEN_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_sp_if, "", p);
      }
    ;

sp_elseifs:
      /* empty */
      {
        $$= NULL;
      }
    | ELSEIF_SYM sp_if
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ELSEIF_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_elseifs, "", p);
      }
    | ELSE sp_proc_stmts1
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ELSE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_sp_elseifs, "", p);
      }
    ;

case_stmt_specification:
      simple_case_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_case_stmt_specification, "", p);
      }
    | searched_case_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_case_stmt_specification, "", p);
      }
    ;

simple_case_stmt:
      CASE_SYM expr simple_when_clause_list else_clause_opt END CASE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CASE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_END));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_CASE_SYM));
        $$= mysql_parser::new_tree_item(sql::_simple_case_stmt, "", p);
      }
    ;

searched_case_stmt:
      CASE_SYM searched_when_clause_list else_clause_opt END CASE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CASE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_END));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_CASE_SYM));
        $$= mysql_parser::new_tree_item(sql::_searched_case_stmt, "", p);
      }
    ;

simple_when_clause_list:
      simple_when_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_when_clause_list, "", p);
      }
    | simple_when_clause_list simple_when_clause
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_simple_when_clause_list, p);
      }
    ;

searched_when_clause_list:
      searched_when_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_searched_when_clause_list, "", p);
      }
    | searched_when_clause_list searched_when_clause
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_searched_when_clause_list, p);
      }
    ;

simple_when_clause:
      WHEN_SYM expr THEN_SYM sp_proc_stmts1
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WHEN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_THEN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_simple_when_clause, "", p);
      }
    ;

searched_when_clause:
      WHEN_SYM expr THEN_SYM sp_proc_stmts1
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WHEN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_THEN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_searched_when_clause, "", p);
      }
    ;

else_clause_opt:
      /* empty */
      {
        $$= NULL;
      }
    | ELSE sp_proc_stmts1
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ELSE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_else_clause_opt, "", p);
      }
    ;

sp_labeled_control:
      label_ident ':' sp_unlabeled_control sp_opt_label
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_58));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_sp_labeled_control, "", p);
      }
    ;

sp_opt_label:
      /* empty */
      {
        $$= NULL;
      }
    | label_ident
      {
        $$= mysql_parser::set_item_name($1, sql::_sp_opt_label);
      }
    ;

sp_unlabeled_control:
      BEGIN_SYM sp_decls sp_proc_stmts END
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BEGIN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_END));
        $$= mysql_parser::new_tree_item(sql::_sp_unlabeled_control, "", p);
      }
    | LOOP_SYM sp_proc_stmts1 END LOOP_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOOP_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_END));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_LOOP_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_unlabeled_control, "", p);
      }
    | WHILE_SYM expr DO_SYM sp_proc_stmts1 END WHILE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WHILE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DO_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_END));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_WHILE_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_unlabeled_control, "", p);
      }
    | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM expr END REPEAT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPEAT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_UNTIL_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_END));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_REPEAT_SYM));
        $$= mysql_parser::new_tree_item(sql::_sp_unlabeled_control, "", p);
      }
    ;

trg_action_time:
      BEFORE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_trg_action_time);
      }
    | AFTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_trg_action_time);
      }
    ;

trg_event:
      INSERT
      {
        $$= mysql_parser::set_item_name($1, sql::_trg_event);
      }
    | UPDATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_trg_event);
      }
    | DELETE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_trg_event);
      }
    ;

change_tablespace_access:
      tablespace_name ts_access_mode
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_change_tablespace_access, "", p);
      }
    ;

change_tablespace_info:
      tablespace_name CHANGE ts_datafile change_ts_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CHANGE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_change_tablespace_info, "", p);
      }
    ;

tablespace_info:
      tablespace_name ADD ts_datafile opt_logfile_group_name tablespace_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ADD));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_tablespace_info, "", p);
      }
    ;

opt_logfile_group_name:
      /* empty */
      {
        $$= NULL;
      }
    | USE_SYM LOGFILE_SYM GROUP_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOGFILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_GROUP_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_logfile_group_name, "", p);
      }
    ;

alter_tablespace_info:
      tablespace_name ADD ts_datafile alter_tablespace_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ADD));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_info, "", p);
      }
    | tablespace_name DROP ts_datafile alter_tablespace_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DROP));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_info, "", p);
      }
    ;

logfile_group_info:
      logfile_group_name add_log_file logfile_group_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_info, "", p);
      }
    ;

alter_logfile_group_info:
      logfile_group_name add_log_file alter_logfile_group_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter_logfile_group_info, "", p);
      }
    ;

add_log_file:
      ADD lg_undofile
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADD));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_add_log_file, "", p);
      }
    | ADD lg_redofile
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADD));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_add_log_file, "", p);
      }
    ;

change_ts_option_list:
      change_ts_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_change_ts_option_list, "", p);
      }
    ;

change_ts_options:
      change_ts_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_change_ts_options, "", p);
      }
    | change_ts_options change_ts_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_change_ts_options, p);
      }
    | change_ts_options ',' change_ts_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_change_ts_options, p);
      }
    ;

change_ts_option:
      opt_ts_initial_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_change_ts_option, "", p);
      }
    | opt_ts_autoextend_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_change_ts_option, "", p);
      }
    | opt_ts_max_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_change_ts_option, "", p);
      }
    ;

tablespace_option_list:
      tablespace_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option_list, "", p);
      }
    ;

tablespace_options:
      tablespace_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_options, "", p);
      }
    | tablespace_options tablespace_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_tablespace_options, p);
      }
    | tablespace_options ',' tablespace_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_tablespace_options, p);
      }
    ;

tablespace_option:
      opt_ts_initial_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | opt_ts_autoextend_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | opt_ts_max_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | opt_ts_extent_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | opt_ts_nodegroup
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | opt_ts_engine
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | ts_wait
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    | opt_ts_comment
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_tablespace_option, "", p);
      }
    ;

alter_tablespace_option_list:
      alter_tablespace_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_option_list, "", p);
      }
    ;

alter_tablespace_options:
      alter_tablespace_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_options, "", p);
      }
    | alter_tablespace_options alter_tablespace_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_alter_tablespace_options, p);
      }
    | alter_tablespace_options ',' alter_tablespace_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_alter_tablespace_options, p);
      }
    ;

alter_tablespace_option:
      opt_ts_initial_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_option, "", p);
      }
    | opt_ts_autoextend_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_option, "", p);
      }
    | opt_ts_max_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_option, "", p);
      }
    | opt_ts_engine
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_option, "", p);
      }
    | ts_wait
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_tablespace_option, "", p);
      }
    ;

logfile_group_option_list:
      logfile_group_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option_list, "", p);
      }
    ;

logfile_group_options:
      logfile_group_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_options, "", p);
      }
    | logfile_group_options logfile_group_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_logfile_group_options, p);
      }
    | logfile_group_options ',' logfile_group_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_logfile_group_options, p);
      }
    ;

logfile_group_option:
      opt_ts_initial_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    | opt_ts_undo_buffer_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    | opt_ts_redo_buffer_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    | opt_ts_nodegroup
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    | opt_ts_engine
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    | ts_wait
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    | opt_ts_comment
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_logfile_group_option, "", p);
      }
    ;

alter_logfile_group_option_list:
      alter_logfile_group_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_logfile_group_option_list, "", p);
      }
    ;

alter_logfile_group_options:
      alter_logfile_group_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_logfile_group_options, "", p);
      }
    | alter_logfile_group_options alter_logfile_group_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_alter_logfile_group_options, p);
      }
    | alter_logfile_group_options ',' alter_logfile_group_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_alter_logfile_group_options, p);
      }
    ;

alter_logfile_group_option:
      opt_ts_initial_size
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_logfile_group_option, "", p);
      }
    | opt_ts_engine
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_logfile_group_option, "", p);
      }
    | ts_wait
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_logfile_group_option, "", p);
      }
    ;

ts_datafile:
      DATAFILE_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATAFILE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_ts_datafile, "", p);
      }
    ;

lg_undofile:
      UNDOFILE_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNDOFILE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_lg_undofile, "", p);
      }
    ;

lg_redofile:
      REDOFILE_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REDOFILE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_lg_redofile, "", p);
      }
    ;

tablespace_name:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_tablespace_name);
      }
    ;

logfile_group_name:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_logfile_group_name);
      }
    ;

ts_access_mode:
      READ_ONLY_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READ_ONLY_SYM));
        $$= mysql_parser::new_tree_item(sql::_ts_access_mode, "", p);
      }
    | READ_WRITE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READ_WRITE_SYM));
        $$= mysql_parser::new_tree_item(sql::_ts_access_mode, "", p);
      }
    | NOT_SYM ACCESSIBLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NOT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ACCESSIBLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_ts_access_mode, "", p);
      }
    ;

opt_ts_initial_size:
      INITIAL_SIZE_SYM opt_equal size_number
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INITIAL_SIZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_initial_size, "", p);
      }
    ;

opt_ts_autoextend_size:
      AUTOEXTEND_SIZE_SYM opt_equal size_number
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AUTOEXTEND_SIZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_autoextend_size, "", p);
      }
    ;

opt_ts_max_size:
      MAX_SIZE_SYM opt_equal size_number
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_SIZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_max_size, "", p);
      }
    ;

opt_ts_extent_size:
      EXTENT_SIZE_SYM opt_equal size_number
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EXTENT_SIZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_extent_size, "", p);
      }
    ;

opt_ts_undo_buffer_size:
      UNDO_BUFFER_SIZE_SYM opt_equal size_number
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNDO_BUFFER_SIZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_undo_buffer_size, "", p);
      }
    ;

opt_ts_redo_buffer_size:
      REDO_BUFFER_SIZE_SYM opt_equal size_number
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REDO_BUFFER_SIZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_redo_buffer_size, "", p);
      }
    ;

opt_ts_nodegroup:
      NODEGROUP_SYM opt_equal real_ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NODEGROUP_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_nodegroup, "", p);
      }
    ;

opt_ts_comment:
      COMMENT_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_comment, "", p);
      }
    ;

opt_ts_engine:
      opt_storage ENGINE_SYM opt_equal storage_engines
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ENGINE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_ts_engine, "", p);
      }
    ;

opt_ts_wait:
      /* empty */
      {
        $$= NULL;
      }
    | ts_wait
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_ts_wait);
      }
    ;

ts_wait:
      WAIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_ts_wait);
      }
    | NO_WAIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_ts_wait);
      }
    ;

size_number:
      real_ulong_num
      {
        $$= mysql_parser::set_item_name($1, sql::_size_number);
      }
    | IDENT
      {
        $$= mysql_parser::set_item_name($1, sql::_size_number);
      }
    ;

create2:
      '(' create2a
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_create2, "", p);
      }
    | opt_create_table_options opt_partitioning create3
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create2, "", p);
      }
    | LIKE table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LIKE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_create2, "", p);
      }
    | '(' LIKE table_ident ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LIKE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_create2, "", p);
      }
    ;

create2a:
      field_list ')' opt_create_table_options opt_partitioning create3
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_41));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_create2a, "", p);
      }
    | opt_partitioning create_select ')' union_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create2a, "", p);
      }
    ;

create3:
      /* empty */
      {
        $$= NULL;
      }
    | opt_duplicate opt_as create_select union_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create3, "", p);
      }
    | opt_duplicate opt_as '(' create_select ')' union_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_create3, "", p);
      }
    ;

opt_partitioning:
      /* empty */
      {
        $$= NULL;
      }
    | partitioning
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_partitioning, "", p);
      }
    ;

partitioning:
      PARTITION_SYM partition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_partitioning, "", p);
      }
    ;

partition_entry:
      PARTITION_SYM partition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_partition_entry, "", p);
      }
    ;

partition:
      BY part_type_def opt_no_parts opt_sub_part part_defs
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BY));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_partition, "", p);
      }
    ;

part_type_def:
      opt_linear KEY_SYM '(' part_field_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_KEY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_part_type_def, "", p);
      }
    | opt_linear HASH_SYM part_func
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_HASH_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_part_type_def, "", p);
      }
    | RANGE_SYM part_func
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RANGE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_part_type_def, "", p);
      }
    | LIST_SYM part_func
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LIST_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_part_type_def, "", p);
      }
    ;

opt_linear:
      /* empty */
      {
        $$= NULL;
      }
    | LINEAR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_linear);
      }
    ;

part_field_list:
      /* empty */
      {
        $$= NULL;
      }
    | part_field_item_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_field_list, "", p);
      }
    ;

part_field_item_list:
      part_field_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_field_item_list, "", p);
      }
    | part_field_item_list ',' part_field_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_part_field_item_list, p);
      }
    ;

part_field_item:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_part_field_item);
      }
    ;

part_func:
      '(' remember_name part_func_expr remember_end ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_part_func, "", p);
      }
    ;

sub_part_func:
      '(' remember_name part_func_expr remember_end ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sub_part_func, "", p);
      }
    ;

opt_no_parts:
      /* empty */
      {
        $$= NULL;
      }
    | PARTITIONS_SYM real_ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PARTITIONS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_no_parts, "", p);
      }
    ;

opt_sub_part:
      /* empty */
      {
        $$= NULL;
      }
    | SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func opt_no_subparts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBPARTITION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_HASH_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_opt_sub_part, "", p);
      }
    | SUBPARTITION_SYM BY opt_linear KEY_SYM '(' sub_part_field_list ')' opt_no_subparts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBPARTITION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_KEY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_40));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_opt_sub_part, "", p);
      }
    ;

sub_part_field_list:
      sub_part_field_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sub_part_field_list, "", p);
      }
    | sub_part_field_list ',' sub_part_field_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sub_part_field_list, p);
      }
    ;

sub_part_field_item:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_sub_part_field_item);
      }
    ;

part_func_expr:
      bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_func_expr, "", p);
      }
    ;

opt_no_subparts:
      /* empty */
      {
        $$= NULL;
      }
    | SUBPARTITIONS_SYM real_ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBPARTITIONS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_no_subparts, "", p);
      }
    ;

part_defs:
      /* empty */
      {
        $$= NULL;
      }
    | '(' part_def_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_part_defs, "", p);
      }
    ;

part_def_list:
      part_definition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_def_list, "", p);
      }
    | part_def_list ',' part_definition
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_part_def_list, p);
      }
    ;

part_definition:
      PARTITION_SYM part_name opt_part_values opt_part_options opt_sub_partition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_part_definition, "", p);
      }
    ;

part_name:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_part_name);
      }
    ;

opt_part_values:
      /* empty */
      {
        $$= NULL;
      }
    | VALUES LESS_SYM THAN_SYM part_func_max
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VALUES));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LESS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_THAN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_part_values, "", p);
      }
    | VALUES IN_SYM '(' part_list_func ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VALUES));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_part_values, "", p);
      }
    ;

part_func_max:
      max_value_sym
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_func_max, "", p);
      }
    | part_range_func
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_func_max, "", p);
      }
    ;

max_value_sym:
      MAX_VALUE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_VALUE_SYM));
        $$= mysql_parser::new_tree_item(sql::_max_value_sym, "", p);
      }
    | '(' MAX_VALUE_SYM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MAX_VALUE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_max_value_sym, "", p);
      }
    ;

part_range_func:
      '(' part_bit_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_part_range_func, "", p);
      }
    ;

part_list_func:
      part_list_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_list_func, "", p);
      }
    | part_list_func ',' part_list_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_part_list_func, p);
      }
    ;

part_list_item:
      part_bit_expr
      {
        $$= mysql_parser::set_item_name($1, sql::_part_list_item);
      }
    ;

part_bit_expr:
      bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_part_bit_expr, "", p);
      }
    ;

opt_sub_partition:
      /* empty */
      {
        $$= NULL;
      }
    | '(' sub_part_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_sub_partition, "", p);
      }
    ;

sub_part_list:
      sub_part_definition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_sub_part_list, "", p);
      }
    | sub_part_list ',' sub_part_definition
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_sub_part_list, p);
      }
    ;

sub_part_definition:
      SUBPARTITION_SYM sub_name opt_part_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBPARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_sub_part_definition, "", p);
      }
    ;

sub_name:
      ident_or_text
      {
        $$= mysql_parser::set_item_name($1, sql::_sub_name);
      }
    ;

opt_part_options:
      /* empty */
      {
        $$= NULL;
      }
    | opt_part_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_part_options, "", p);
      }
    ;

opt_part_option_list:
      opt_part_option_list opt_part_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_opt_part_option_list, p);
      }
    | opt_part_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option_list, "", p);
      }
    ;

opt_part_option:
      TABLESPACE opt_equal ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | opt_storage ENGINE_SYM opt_equal storage_engines
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ENGINE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | NODEGROUP_SYM opt_equal real_ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NODEGROUP_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | MAX_ROWS opt_equal real_ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_ROWS));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | MIN_ROWS opt_equal real_ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MIN_ROWS));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DIRECTORY_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INDEX_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DIRECTORY_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    | COMMENT_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_part_option, "", p);
      }
    ;

create_select:
      SELECT_SYM select_options select_item_list opt_select_from
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SELECT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create_select, "", p);
      }
    ;

opt_as:
      /* empty */
      {
        $$= NULL;
      }
    | AS
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_as);
      }
    ;

opt_create_database_options:
      /* empty */
      {
        $$= NULL;
      }
    | create_database_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_create_database_options, "", p);
      }
    ;

create_database_options:
      create_database_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_database_options, "", p);
      }
    | create_database_options create_database_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_create_database_options, p);
      }
    ;

create_database_option:
      default_collation
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_database_option, "", p);
      }
    | default_charset
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_database_option, "", p);
      }
    ;

opt_table_options:
      /* empty */
      {
        $$= NULL;
      }
    | table_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_table_options, "", p);
      }
    ;

table_options:
      table_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_options, "", p);
      }
    | table_option table_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_table_options, "", p);
      }
    ;

table_option:
      TEMPORARY
      {
        $$= mysql_parser::set_item_name($1, sql::_table_option);
      }
    ;

opt_if_not_exists:
      /* empty */
      {
        $$= NULL;
      }
    | IF not EXISTS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IF));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_EXISTS));
        $$= mysql_parser::new_tree_item(sql::_opt_if_not_exists, "", p);
      }
    ;

opt_create_table_options:
      /* empty */
      {
        $$= NULL;
      }
    | create_table_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_create_table_options, "", p);
      }
    ;

create_table_options_space_separated:
      create_table_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_table_options_space_separated, "", p);
      }
    | create_table_option create_table_options_space_separated
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_create_table_options_space_separated, "", p);
      }
    ;

create_table_options:
      create_table_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_table_options, "", p);
      }
    | create_table_option create_table_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_create_table_options, "", p);
      }
    | create_table_option ',' create_table_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add_all(p, $3);
        mysql_parser::delete_tree_item($3);
        $$= mysql_parser::new_tree_item(sql::_create_table_options, "", p);
      }
    ;

create_table_option:
      ENGINE_SYM opt_equal storage_engines
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENGINE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | TYPE_SYM opt_equal storage_engines
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TYPE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | MAX_ROWS opt_equal ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_ROWS));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | MIN_ROWS opt_equal ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MIN_ROWS));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | AVG_ROW_LENGTH opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AVG_ROW_LENGTH));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | PASSWORD opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | COMMENT_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | AUTO_INC opt_equal ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AUTO_INC));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | PACK_KEYS_SYM opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PACK_KEYS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | PACK_KEYS_SYM opt_equal DEFAULT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PACK_KEYS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DEFAULT));
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | CHECKSUM_SYM opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHECKSUM_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | DELAY_KEY_WRITE_SYM opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DELAY_KEY_WRITE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | ROW_FORMAT_SYM opt_equal row_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ROW_FORMAT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | UNION_SYM opt_equal '(' table_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | default_charset
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | default_collation
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | INSERT_METHOD opt_equal merge_insert_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INSERT_METHOD));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DIRECTORY_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INDEX_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DIRECTORY_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | TABLESPACE ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | STORAGE_SYM DISK_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STORAGE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DISK_SYM));
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | STORAGE_SYM MEMORY_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STORAGE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MEMORY_SYM));
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | CONNECTION_SYM opt_equal TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONNECTION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | KEY_BLOCK_SIZE opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_KEY_BLOCK_SIZE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    | TRANSACTIONAL_SYM opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRANSACTIONAL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_create_table_option, "", p);
      }
    ;

default_charset:
      opt_default charset opt_equal charset_name_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_default_charset, "", p);
      }
    ;

default_collation:
      opt_default COLLATE_SYM opt_equal collation_name_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COLLATE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_default_collation, "", p);
      }
    ;

storage_engines:
      ident_or_text
      {
        $$= mysql_parser::set_item_name($1, sql::_storage_engines);
      }
    ;

known_storage_engines:
      ident_or_text
      {
        $$= mysql_parser::set_item_name($1, sql::_known_storage_engines);
      }
    ;

row_types:
      DEFAULT
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    | FIXED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    | DYNAMIC_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    | COMPRESSED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    | REDUNDANT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    | COMPACT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    | PAGE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_row_types);
      }
    ;

merge_insert_types:
      NO_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_merge_insert_types);
      }
    | FIRST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_merge_insert_types);
      }
    | LAST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_merge_insert_types);
      }
    ;

opt_select_from:
      opt_limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_select_from, "", p);
      }
    | select_from select_lock_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_select_from, "", p);
      }
    ;

udf_type:
      STRING_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_udf_type);
      }
    | REAL
      {
        $$= mysql_parser::set_item_name($1, sql::_udf_type);
      }
    | DECIMAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_udf_type);
      }
    | INT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_udf_type);
      }
    ;

field_list:
      field_list_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_list, "", p);
      }
    | field_list ',' field_list_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_field_list, p);
      }
    ;

field_list_item:
      column_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_list_item, "", p);
      }
    | key_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_list_item, "", p);
      }
    ;

column_def:
      field_spec opt_check_constraint
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_column_def, "", p);
      }
    | field_spec references
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_column_def, "", p);
      }
    ;

key_def:
      key_type opt_ident key_alg '(' key_list ')' key_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        mysql_parser::tree_item_list_add(p, $7);
        $$= mysql_parser::new_tree_item(sql::_key_def, "", p);
      }
    | opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')' key_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_40));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_key_def, "", p);
      }
    | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FOREIGN));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_KEY_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_40));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_key_def, "", p);
      }
    | constraint opt_check_constraint
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_def, "", p);
      }
    | opt_constraint check_constraint
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_def, "", p);
      }
    ;

opt_check_constraint:
      /* empty */
      {
        $$= NULL;
      }
    | check_constraint
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_check_constraint, "", p);
      }
    ;

check_constraint:
      CHECK_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHECK_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_check_constraint, "", p);
      }
    ;

opt_constraint:
      /* empty */
      {
        $$= NULL;
      }
    | constraint
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_constraint, "", p);
      }
    ;

constraint:
      CONSTRAINT opt_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONSTRAINT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_constraint, "", p);
      }
    ;

field_spec:
      field_ident type opt_attribute
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_field_spec, "", p);
      }
    ;

type:
      int_type opt_len field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | real_type opt_precision field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | FLOAT_SYM float_options field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FLOAT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BIT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BIT_SYM));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BIT_SYM '(' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BIT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BOOL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BOOL_SYM));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BOOLEAN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BOOLEAN_SYM));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | char '(' NUM ')' opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | char opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | nchar '(' NUM ')' opt_bin_mod
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | nchar opt_bin_mod
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BINARY '(' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINARY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BINARY
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINARY));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | varchar '(' NUM ')' opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | nvarchar '(' NUM ')' opt_bin_mod
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | VARBINARY '(' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VARBINARY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | YEAR_SYM opt_len field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_YEAR_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | DATE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATE_SYM));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | TIME_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIME_SYM));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | TIMESTAMP opt_len
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIMESTAMP));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | DATETIME
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATETIME));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | TINYBLOB
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TINYBLOB));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | BLOB_SYM opt_len
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BLOB_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | spatial_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | MEDIUMBLOB
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MEDIUMBLOB));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | LONGBLOB
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LONGBLOB));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | LONG_SYM VARBINARY
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LONG_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VARBINARY));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | LONG_SYM varchar opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LONG_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | TINYTEXT opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TINYTEXT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | TEXT_SYM opt_len opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TEXT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | MEDIUMTEXT opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MEDIUMTEXT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | LONGTEXT opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LONGTEXT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | DECIMAL_SYM float_options field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DECIMAL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | NUMERIC_SYM float_options field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NUMERIC_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | FIXED_SYM float_options field_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FIXED_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | ENUM '(' string_list ')' opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | SET '(' string_list ')' opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | LONG_SYM opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LONG_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    | SERIAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SERIAL_SYM));
        $$= mysql_parser::new_tree_item(sql::_type, "", p);
      }
    ;

spatial_type:
      GEOMETRY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | GEOMETRYCOLLECTION
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | POINT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | MULTIPOINT
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | LINESTRING
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | MULTILINESTRING
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | POLYGON
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    | MULTIPOLYGON
      {
        $$= mysql_parser::set_item_name($1, sql::_spatial_type);
      }
    ;

char:
      CHAR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_char);
      }
    ;

nchar:
      NCHAR_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NCHAR_SYM));
        $$= mysql_parser::new_tree_item(sql::_nchar, "", p);
      }
    | NATIONAL_SYM CHAR_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NATIONAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CHAR_SYM));
        $$= mysql_parser::new_tree_item(sql::_nchar, "", p);
      }
    ;

varchar:
      char VARYING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VARYING));
        $$= mysql_parser::new_tree_item(sql::_varchar, "", p);
      }
    | VARCHAR
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VARCHAR));
        $$= mysql_parser::new_tree_item(sql::_varchar, "", p);
      }
    ;

nvarchar:
      NATIONAL_SYM VARCHAR
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NATIONAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VARCHAR));
        $$= mysql_parser::new_tree_item(sql::_nvarchar, "", p);
      }
    | NVARCHAR_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NVARCHAR_SYM));
        $$= mysql_parser::new_tree_item(sql::_nvarchar, "", p);
      }
    | NCHAR_SYM VARCHAR
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NCHAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VARCHAR));
        $$= mysql_parser::new_tree_item(sql::_nvarchar, "", p);
      }
    | NATIONAL_SYM CHAR_SYM VARYING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NATIONAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CHAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_VARYING));
        $$= mysql_parser::new_tree_item(sql::_nvarchar, "", p);
      }
    | NCHAR_SYM VARYING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NCHAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VARYING));
        $$= mysql_parser::new_tree_item(sql::_nvarchar, "", p);
      }
    ;

int_type:
      INT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_int_type);
      }
    | TINYINT
      {
        $$= mysql_parser::set_item_name($1, sql::_int_type);
      }
    | SMALLINT
      {
        $$= mysql_parser::set_item_name($1, sql::_int_type);
      }
    | MEDIUMINT
      {
        $$= mysql_parser::set_item_name($1, sql::_int_type);
      }
    | BIGINT
      {
        $$= mysql_parser::set_item_name($1, sql::_int_type);
      }
    ;

real_type:
      REAL
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REAL));
        $$= mysql_parser::new_tree_item(sql::_real_type, "", p);
      }
    | DOUBLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DOUBLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_real_type, "", p);
      }
    | DOUBLE_SYM PRECISION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DOUBLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PRECISION));
        $$= mysql_parser::new_tree_item(sql::_real_type, "", p);
      }
    ;

float_options:
      /* empty */
      {
        $$= NULL;
      }
    | '(' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_float_options, "", p);
      }
    | precision
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_float_options, "", p);
      }
    ;

precision:
      '(' NUM ',' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_44));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_precision, "", p);
      }
    ;

field_options:
      /* empty */
      {
        $$= NULL;
      }
    | field_opt_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_options, "", p);
      }
    ;

field_opt_list:
      field_opt_list field_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_field_opt_list, p);
      }
    | field_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_opt_list, "", p);
      }
    ;

field_option:
      SIGNED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_field_option);
      }
    | UNSIGNED
      {
        $$= mysql_parser::set_item_name($1, sql::_field_option);
      }
    | ZEROFILL
      {
        $$= mysql_parser::set_item_name($1, sql::_field_option);
      }
    ;

opt_len:
      /* empty */
      {
        $$= NULL;
      }
    | '(' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_len, "", p);
      }
    ;

opt_precision:
      /* empty */
      {
        $$= NULL;
      }
    | precision
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_precision, "", p);
      }
    ;

opt_attribute:
      /* empty */
      {
        $$= NULL;
      }
    | opt_attribute_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_attribute, "", p);
      }
    ;

opt_attribute_list:
      opt_attribute_list attribute
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_opt_attribute_list, p);
      }
    | attribute
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_attribute_list, "", p);
      }
    ;

attribute:
      NULL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NULL_SYM));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | not NULL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NULL_SYM));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | DEFAULT now_or_signed_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFAULT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | ON UPDATE_SYM NOW_SYM optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_UPDATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NOW_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | AUTO_INC
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AUTO_INC));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | SERIAL_SYM DEFAULT VALUE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SERIAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DEFAULT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_VALUE_SYM));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | opt_primary KEY_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_KEY_SYM));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | UNIQUE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNIQUE_SYM));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | UNIQUE_SYM KEY_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNIQUE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_KEY_SYM));
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | COMMENT_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMENT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    | COLLATE_SYM collation_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COLLATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_attribute, "", p);
      }
    ;

now_or_signed_literal:
      NOW_SYM optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NOW_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_now_or_signed_literal, "", p);
      }
    | signed_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_now_or_signed_literal, "", p);
      }
    ;

charset:
      CHAR_SYM SET
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SET));
        $$= mysql_parser::new_tree_item(sql::_charset, "", p);
      }
    | CHARSET
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHARSET));
        $$= mysql_parser::new_tree_item(sql::_charset, "", p);
      }
    ;

charset_name:
      ident_or_text
      {
        $$= mysql_parser::set_item_name($1, sql::_charset_name);
      }
    | BINARY
      {
        $$= mysql_parser::set_item_name($1, sql::_charset_name);
      }
    ;

charset_name_or_default:
      charset_name
      {
        $$= mysql_parser::set_item_name($1, sql::_charset_name_or_default);
      }
    | DEFAULT
      {
        $$= mysql_parser::set_item_name($1, sql::_charset_name_or_default);
      }
    ;

opt_load_data_charset:
      /* empty */
      {
        $$= NULL;
      }
    | charset charset_name_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_load_data_charset, "", p);
      }
    ;

old_or_new_charset_name:
      ident_or_text
      {
        $$= mysql_parser::set_item_name($1, sql::_old_or_new_charset_name);
      }
    | BINARY
      {
        $$= mysql_parser::set_item_name($1, sql::_old_or_new_charset_name);
      }
    ;

old_or_new_charset_name_or_default:
      old_or_new_charset_name
      {
        $$= mysql_parser::set_item_name($1, sql::_old_or_new_charset_name_or_default);
      }
    | DEFAULT
      {
        $$= mysql_parser::set_item_name($1, sql::_old_or_new_charset_name_or_default);
      }
    ;

collation_name:
      ident_or_text
      {
        $$= mysql_parser::set_item_name($1, sql::_collation_name);
      }
    ;

opt_collate:
      /* empty */
      {
        $$= NULL;
      }
    | COLLATE_SYM collation_name_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COLLATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_collate, "", p);
      }
    ;

collation_name_or_default:
      collation_name
      {
        $$= mysql_parser::set_item_name($1, sql::_collation_name_or_default);
      }
    | DEFAULT
      {
        $$= mysql_parser::set_item_name($1, sql::_collation_name_or_default);
      }
    ;

opt_default:
      /* empty */
      {
        $$= NULL;
      }
    | DEFAULT
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_default);
      }
    ;

opt_binary:
      /* empty */
      {
        $$= NULL;
      }
    | ASCII_SYM opt_bin_mod
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ASCII_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_binary, "", p);
      }
    | BYTE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BYTE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_binary, "", p);
      }
    | UNICODE_SYM opt_bin_mod
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNICODE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_binary, "", p);
      }
    | charset charset_name opt_bin_mod
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_binary, "", p);
      }
    | BINARY opt_bin_charset
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINARY));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_binary, "", p);
      }
    ;

opt_bin_mod:
      /* empty */
      {
        $$= NULL;
      }
    | BINARY
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_bin_mod);
      }
    ;

opt_bin_charset:
      /* empty */
      {
        $$= NULL;
      }
    | ASCII_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ASCII_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_bin_charset, "", p);
      }
    | UNICODE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNICODE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_bin_charset, "", p);
      }
    | charset charset_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_bin_charset, "", p);
      }
    ;

opt_primary:
      /* empty */
      {
        $$= NULL;
      }
    | PRIMARY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_primary);
      }
    ;

references:
      REFERENCES table_ident opt_ref_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REFERENCES));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_references, "", p);
      }
    ;

opt_ref_list:
      opt_on_delete
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_ref_list, "", p);
      }
    | '(' ref_list ')' opt_on_delete
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_opt_ref_list, "", p);
      }
    ;

ref_list:
      ref_list ',' ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_ref_list, p);
      }
    | ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ref_list, "", p);
      }
    ;

opt_on_delete:
      /* empty */
      {
        $$= NULL;
      }
    | opt_on_delete_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete, "", p);
      }
    ;

opt_on_delete_list:
      opt_on_delete_list opt_on_delete_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_opt_on_delete_list, p);
      }
    | opt_on_delete_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete_list, "", p);
      }
    ;

opt_on_delete_item:
      ON DELETE_SYM delete_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DELETE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete_item, "", p);
      }
    | ON UPDATE_SYM delete_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_UPDATE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete_item, "", p);
      }
    | MATCH FULL
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MATCH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FULL));
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete_item, "", p);
      }
    | MATCH PARTIAL
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MATCH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTIAL));
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete_item, "", p);
      }
    | MATCH SIMPLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MATCH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SIMPLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_on_delete_item, "", p);
      }
    ;

delete_option:
      RESTRICT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RESTRICT));
        $$= mysql_parser::new_tree_item(sql::_delete_option, "", p);
      }
    | CASCADE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CASCADE));
        $$= mysql_parser::new_tree_item(sql::_delete_option, "", p);
      }
    | SET NULL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NULL_SYM));
        $$= mysql_parser::new_tree_item(sql::_delete_option, "", p);
      }
    | NO_SYM ACTION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NO_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ACTION));
        $$= mysql_parser::new_tree_item(sql::_delete_option, "", p);
      }
    | SET DEFAULT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DEFAULT));
        $$= mysql_parser::new_tree_item(sql::_delete_option, "", p);
      }
    ;

key_type:
      key_or_index
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_type, "", p);
      }
    | FULLTEXT_SYM opt_key_or_index
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FULLTEXT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_type, "", p);
      }
    | SPATIAL_SYM opt_key_or_index
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SPATIAL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_type, "", p);
      }
    ;

constraint_key_type:
      PRIMARY_SYM KEY_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PRIMARY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_KEY_SYM));
        $$= mysql_parser::new_tree_item(sql::_constraint_key_type, "", p);
      }
    | UNIQUE_SYM opt_key_or_index
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNIQUE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_constraint_key_type, "", p);
      }
    ;

key_or_index:
      KEY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_key_or_index);
      }
    | INDEX_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_key_or_index);
      }
    ;

opt_key_or_index:
      /* empty */
      {
        $$= NULL;
      }
    | key_or_index
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_key_or_index);
      }
    ;

keys_or_index:
      KEYS
      {
        $$= mysql_parser::set_item_name($1, sql::_keys_or_index);
      }
    | INDEX_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keys_or_index);
      }
    | INDEXES
      {
        $$= mysql_parser::set_item_name($1, sql::_keys_or_index);
      }
    ;

opt_unique_or_fulltext:
      /* empty */
      {
        $$= NULL;
      }
    | UNIQUE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_unique_or_fulltext);
      }
    | FULLTEXT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_unique_or_fulltext);
      }
    | SPATIAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_unique_or_fulltext);
      }
    ;

init_key_options:
      /* empty */
      {
        $$= NULL;
      }
    ;

key_alg:
      init_key_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_alg, "", p);
      }
    | init_key_options key_using_alg
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_alg, "", p);
      }
    ;

key_options:
      /* empty */
      {
        $$= NULL;
      }
    | key_opts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_options, "", p);
      }
    ;

key_opts:
      key_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_opts, "", p);
      }
    | key_opts key_opt
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_key_opts, p);
      }
    ;

key_using_alg:
      USING btree_or_rtree
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USING));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_using_alg, "", p);
      }
    | TYPE_SYM btree_or_rtree
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TYPE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_using_alg, "", p);
      }
    ;

key_opt:
      key_using_alg
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_opt, "", p);
      }
    | KEY_BLOCK_SIZE opt_equal ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_KEY_BLOCK_SIZE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_key_opt, "", p);
      }
    | WITH PARSER_SYM IDENT_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARSER_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_key_opt, "", p);
      }
    ;

btree_or_rtree:
      BTREE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_btree_or_rtree);
      }
    | RTREE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_btree_or_rtree);
      }
    | HASH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_btree_or_rtree);
      }
    ;

key_list:
      key_list ',' key_part order_dir
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::tree_item_reuse($1, sql::_key_list, p);
      }
    | key_part order_dir
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_key_list, "", p);
      }
    ;

key_part:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_part, "", p);
      }
    | ident '(' NUM ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_key_part, "", p);
      }
    ;

opt_ident:
      /* empty */
      {
        $$= NULL;
      }
    | field_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_ident, "", p);
      }
    ;

opt_component:
      /* empty */
      {
        $$= NULL;
      }
    | '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_46));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_component, "", p);
      }
    ;

string_list:
      text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_string_list, "", p);
      }
    | string_list ',' text_string
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_string_list, p);
      }
    ;

alter:
      ALTER opt_ignore TABLE_SYM table_ident alter_commands
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER DATABASE ident_or_empty create_database_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_UPGRADE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_DATA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_DIRECTORY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_NAME_SYM));
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER PROCEDURE sp_name sp_a_chistics
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER FUNCTION_SYM sp_name sp_a_chistics
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER view_algorithm definer_opt view_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER definer_opt view_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER definer_opt EVENT_SYM sp_name ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_status opt_ev_comment opt_ev_sql_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_EVENT_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, $9);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER TABLESPACE alter_tablespace_info
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER LOGFILE_SYM GROUP_SYM alter_logfile_group_info
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOGFILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_GROUP_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER TABLESPACE change_tablespace_info
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER TABLESPACE change_tablespace_access
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    | ALTER SERVER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SERVER_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_OPTIONS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_40));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_alter, "", p);
      }
    ;

ev_alter_on_schedule_completion:
      /* empty */
      {
        $$= NULL;
      }
    | ON SCHEDULE_SYM ev_schedule_time
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SCHEDULE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_ev_alter_on_schedule_completion, "", p);
      }
    | ev_on_completion
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ev_alter_on_schedule_completion, "", p);
      }
    | ON SCHEDULE_SYM ev_schedule_time ev_on_completion
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SCHEDULE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_ev_alter_on_schedule_completion, "", p);
      }
    ;

opt_ev_rename_to:
      /* empty */
      {
        $$= NULL;
      }
    | RENAME TO_SYM sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RENAME));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_opt_ev_rename_to, "", p);
      }
    ;

opt_ev_sql_stmt:
      /* empty */
      {
        $$= NULL;
      }
    | DO_SYM ev_sql_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DO_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_ev_sql_stmt, "", p);
      }
    ;

ident_or_empty:
      /* empty */
      {
        $$= NULL;
      }
    | ident
      {
        $$= mysql_parser::set_item_name($1, sql::_ident_or_empty);
      }
    ;

alter_commands:
      /* empty */
      {
        $$= NULL;
      }
    | DISCARD TABLESPACE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DISCARD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | IMPORT TABLESPACE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IMPORT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | alter_list opt_partitioning
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | alter_list remove_partitioning
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | remove_partitioning
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | partitioning
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | add_partition_rule
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | DROP PARTITION_SYM alt_part_name_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | REBUILD_SYM PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REBUILD_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | OPTIMIZE PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_no_write_to_binlog
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OPTIMIZE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ANALYZE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | CHECK_SYM PARTITION_SYM all_or_alt_part_name_list opt_mi_check_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHECK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | REPAIR PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_mi_repair_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPAIR));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COALESCE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    | reorg_partition_rule
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_commands, "", p);
      }
    ;

remove_partitioning:
      REMOVE_SYM PARTITIONING_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REMOVE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITIONING_SYM));
        $$= mysql_parser::new_tree_item(sql::_remove_partitioning, "", p);
      }
    ;

all_or_alt_part_name_list:
      ALL
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALL));
        $$= mysql_parser::new_tree_item(sql::_all_or_alt_part_name_list, "", p);
      }
    | alt_part_name_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_all_or_alt_part_name_list, "", p);
      }
    ;

add_partition_rule:
      ADD PARTITION_SYM opt_no_write_to_binlog add_part_extra
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_add_partition_rule, "", p);
      }
    ;

add_part_extra:
      /* empty */
      {
        $$= NULL;
      }
    | '(' part_def_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_add_part_extra, "", p);
      }
    | PARTITIONS_SYM real_ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PARTITIONS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_add_part_extra, "", p);
      }
    ;

reorg_partition_rule:
      REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog reorg_parts_rule
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REORGANIZE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PARTITION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_reorg_partition_rule, "", p);
      }
    ;

reorg_parts_rule:
      /* empty */
      {
        $$= NULL;
      }
    | alt_part_name_list INTO '(' part_def_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_INTO));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_reorg_parts_rule, "", p);
      }
    ;

alt_part_name_list:
      alt_part_name_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alt_part_name_list, "", p);
      }
    | alt_part_name_list ',' alt_part_name_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_alt_part_name_list, p);
      }
    ;

alt_part_name_item:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_alt_part_name_item);
      }
    ;

alter_list:
      alter_list_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_list, "", p);
      }
    | alter_list ',' alter_list_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_alter_list, p);
      }
    ;

add_column:
      ADD opt_column
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADD));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_add_column, "", p);
      }
    ;

alter_list_item:
      add_column column_def opt_place
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | ADD key_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADD));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | add_column '(' field_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | CHANGE opt_column field_ident field_spec opt_place
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHANGE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | MODIFY_SYM opt_column field_ident type opt_attribute opt_place
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MODIFY_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | DROP opt_column field_ident opt_restrict
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | DROP FOREIGN KEY_SYM opt_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FOREIGN));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_KEY_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | DROP PRIMARY_SYM KEY_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PRIMARY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_KEY_SYM));
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | DROP key_or_index field_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | DISABLE_SYM KEYS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DISABLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_KEYS));
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | ENABLE_SYM KEYS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENABLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_KEYS));
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | ALTER opt_column field_ident SET DEFAULT signed_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_SET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_DEFAULT));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | ALTER opt_column field_ident DROP DEFAULT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_DEFAULT));
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | RENAME opt_to table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RENAME));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONVERT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | create_table_options_space_separated
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | FORCE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FORCE_SYM));
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    | alter_order_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_list_item, "", p);
      }
    ;

opt_column:
      /* empty */
      {
        $$= NULL;
      }
    | COLUMN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_column);
      }
    ;

opt_ignore:
      /* empty */
      {
        $$= NULL;
      }
    | IGNORE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_ignore);
      }
    ;

opt_restrict:
      /* empty */
      {
        $$= NULL;
      }
    | RESTRICT
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_restrict);
      }
    | CASCADE
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_restrict);
      }
    ;

opt_place:
      /* empty */
      {
        $$= NULL;
      }
    | AFTER_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AFTER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_place, "", p);
      }
    | FIRST_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FIRST_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_place, "", p);
      }
    ;

opt_to:
      /* empty */
      {
        $$= NULL;
      }
    | TO_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_to);
      }
    | EQ
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_to);
      }
    | AS
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_to);
      }
    ;

slave:
      START_SYM SLAVE slave_thread_opts slave_until
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_START_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_slave, "", p);
      }
    | STOP_SYM SLAVE slave_thread_opts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STOP_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_slave, "", p);
      }
    | SLAVE START_SYM slave_thread_opts slave_until
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_START_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_slave, "", p);
      }
    | SLAVE STOP_SYM slave_thread_opts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STOP_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_slave, "", p);
      }
    ;

start:
      START_SYM TRANSACTION_SYM start_transaction_opts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_START_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TRANSACTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_start, "", p);
      }
    ;

start_transaction_opts:
      /* empty */
      {
        $$= NULL;
      }
    | WITH CONSISTENT_SYM SNAPSHOT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CONSISTENT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_SNAPSHOT_SYM));
        $$= mysql_parser::new_tree_item(sql::_start_transaction_opts, "", p);
      }
    ;

slave_thread_opts:
      slave_thread_opt_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_slave_thread_opts, "", p);
      }
    ;

slave_thread_opt_list:
      slave_thread_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_slave_thread_opt_list, "", p);
      }
    | slave_thread_opt_list ',' slave_thread_opt
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_slave_thread_opt_list, p);
      }
    ;

slave_thread_opt:
      /* empty */
      {
        $$= NULL;
      }
    | SQL_THREAD
      {
        $$= mysql_parser::set_item_name($1, sql::_slave_thread_opt);
      }
    | RELAY_THREAD
      {
        $$= mysql_parser::set_item_name($1, sql::_slave_thread_opt);
      }
    ;

slave_until:
      /* empty */
      {
        $$= NULL;
      }
    | UNTIL_SYM slave_until_opts
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNTIL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_slave_until, "", p);
      }
    ;

slave_until_opts:
      master_file_def
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_slave_until_opts, "", p);
      }
    | slave_until_opts ',' master_file_def
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_slave_until_opts, p);
      }
    ;

restore:
      RESTORE_SYM table_or_tables table_list FROM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RESTORE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_restore, "", p);
      }
    ;

backup:
      BACKUP_SYM table_or_tables table_list TO_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BACKUP_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_backup, "", p);
      }
    ;

checksum:
      CHECKSUM_SYM table_or_tables table_list opt_checksum_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHECKSUM_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_checksum, "", p);
      }
    ;

opt_checksum_type:
      /* empty */
      {
        $$= NULL;
      }
    | QUICK
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_checksum_type);
      }
    | EXTENDED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_checksum_type);
      }
    ;

repair:
      REPAIR opt_no_write_to_binlog table_or_tables table_list opt_mi_repair_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPAIR));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_repair, "", p);
      }
    ;

opt_mi_repair_type:
      /* empty */
      {
        $$= NULL;
      }
    | mi_repair_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_mi_repair_type, "", p);
      }
    ;

mi_repair_types:
      mi_repair_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_mi_repair_types, "", p);
      }
    | mi_repair_type mi_repair_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_mi_repair_types, "", p);
      }
    ;

mi_repair_type:
      QUICK
      {
        $$= mysql_parser::set_item_name($1, sql::_mi_repair_type);
      }
    | EXTENDED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_mi_repair_type);
      }
    | USE_FRM
      {
        $$= mysql_parser::set_item_name($1, sql::_mi_repair_type);
      }
    ;

analyze:
      ANALYZE_SYM opt_no_write_to_binlog table_or_tables table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ANALYZE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_analyze, "", p);
      }
    ;

binlog_base64_event:
      BINLOG_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINLOG_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_binlog_base64_event, "", p);
      }
    ;

check:
      CHECK_SYM table_or_tables table_list opt_mi_check_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHECK_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_check, "", p);
      }
    ;

opt_mi_check_type:
      /* empty */
      {
        $$= NULL;
      }
    | mi_check_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_mi_check_type, "", p);
      }
    ;

mi_check_types:
      mi_check_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_mi_check_types, "", p);
      }
    | mi_check_type mi_check_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_mi_check_types, "", p);
      }
    ;

mi_check_type:
      QUICK
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_QUICK));
        $$= mysql_parser::new_tree_item(sql::_mi_check_type, "", p);
      }
    | FAST_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FAST_SYM));
        $$= mysql_parser::new_tree_item(sql::_mi_check_type, "", p);
      }
    | MEDIUM_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MEDIUM_SYM));
        $$= mysql_parser::new_tree_item(sql::_mi_check_type, "", p);
      }
    | EXTENDED_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EXTENDED_SYM));
        $$= mysql_parser::new_tree_item(sql::_mi_check_type, "", p);
      }
    | CHANGED
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHANGED));
        $$= mysql_parser::new_tree_item(sql::_mi_check_type, "", p);
      }
    | FOR_SYM UPGRADE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_UPGRADE_SYM));
        $$= mysql_parser::new_tree_item(sql::_mi_check_type, "", p);
      }
    ;

optimize:
      OPTIMIZE opt_no_write_to_binlog table_or_tables table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OPTIMIZE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_optimize, "", p);
      }
    ;

opt_no_write_to_binlog:
      /* empty */
      {
        $$= NULL;
      }
    | NO_WRITE_TO_BINLOG
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_no_write_to_binlog);
      }
    | LOCAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_no_write_to_binlog);
      }
    ;

rename:
      RENAME table_or_tables table_to_table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RENAME));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_rename, "", p);
      }
    | RENAME USER clear_privileges rename_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RENAME));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_USER));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_rename, "", p);
      }
    ;

rename_list:
      user TO_SYM user
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_rename_list, "", p);
      }
    | rename_list ',' user TO_SYM user
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::tree_item_reuse($1, sql::_rename_list, p);
      }
    ;

table_to_table_list:
      table_to_table
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_to_table_list, "", p);
      }
    | table_to_table_list ',' table_to_table
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_table_to_table_list, p);
      }
    ;

table_to_table:
      table_ident TO_SYM table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_table_to_table, "", p);
      }
    ;

keycache:
      CACHE_SYM INDEX_SYM keycache_list IN_SYM key_cache_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CACHE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_INDEX_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_keycache, "", p);
      }
    ;

keycache_list:
      assign_to_keycache
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_keycache_list, "", p);
      }
    | keycache_list ',' assign_to_keycache
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_keycache_list, p);
      }
    ;

assign_to_keycache:
      table_ident cache_keys_spec
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_assign_to_keycache, "", p);
      }
    ;

key_cache_name:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_key_cache_name);
      }
    | DEFAULT
      {
        $$= mysql_parser::set_item_name($1, sql::_key_cache_name);
      }
    ;

preload:
      LOAD INDEX_SYM INTO CACHE_SYM preload_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOAD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_INDEX_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INTO));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_CACHE_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_preload, "", p);
      }
    ;

preload_list:
      preload_keys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_preload_list, "", p);
      }
    | preload_list ',' preload_keys
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_preload_list, p);
      }
    ;

preload_keys:
      table_ident cache_keys_spec opt_ignore_leaves
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_preload_keys, "", p);
      }
    ;

cache_keys_spec:
      cache_key_list_or_empty
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_cache_keys_spec, "", p);
      }
    ;

cache_key_list_or_empty:
      /* empty */
      {
        $$= NULL;
      }
    | key_or_index '(' opt_key_usage_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_cache_key_list_or_empty, "", p);
      }
    ;

opt_ignore_leaves:
      /* empty */
      {
        $$= NULL;
      }
    | IGNORE_SYM LEAVES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IGNORE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LEAVES));
        $$= mysql_parser::new_tree_item(sql::_opt_ignore_leaves, "", p);
      }
    ;

select:
      select_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select, "", p);
      }
    ;

select_init:
      SELECT_SYM select_init2
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SELECT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_init, "", p);
      }
    | '(' select_paren ')' union_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_select_init, "", p);
      }
    ;

select_paren:
      SELECT_SYM select_part2
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SELECT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_paren, "", p);
      }
    | '(' select_paren ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_select_paren, "", p);
      }
    ;

select_init2:
      select_part2 union_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_init2, "", p);
      }
    ;

select_part2:
      select_options select_item_list select_into select_lock_type
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_select_part2, "", p);
      }
    ;

select_into:
      opt_order_clause opt_limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_into, "", p);
      }
    | into
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_into, "", p);
      }
    | select_from
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_into, "", p);
      }
    | into select_from
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_into, "", p);
      }
    | select_from into
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_into, "", p);
      }
    ;

select_from:
      FROM join_table_list where_clause group_clause having_clause opt_order_clause opt_limit_clause procedure_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_select_from, "", p);
      }
    | FROM DUAL_SYM where_clause opt_limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DUAL_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_select_from, "", p);
      }
    ;

select_options:
      /* empty */
      {
        $$= NULL;
      }
    | select_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_options, "", p);
      }
    ;

select_option_list:
      select_option_list select_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_select_option_list, p);
      }
    | select_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_option_list, "", p);
      }
    ;

select_option:
      STRAIGHT_JOIN
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | HIGH_PRIORITY
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | DISTINCT
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | SQL_SMALL_RESULT
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | SQL_BIG_RESULT
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | SQL_BUFFER_RESULT
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | SQL_CALC_FOUND_ROWS
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | SQL_NO_CACHE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | SQL_CACHE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    | ALL
      {
        $$= mysql_parser::set_item_name($1, sql::_select_option);
      }
    ;

select_lock_type:
      /* empty */
      {
        $$= NULL;
      }
    | FOR_SYM UPDATE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_UPDATE_SYM));
        $$= mysql_parser::new_tree_item(sql::_select_lock_type, "", p);
      }
    | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOCK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_SHARE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_MODE_SYM));
        $$= mysql_parser::new_tree_item(sql::_select_lock_type, "", p);
      }
    ;

select_item_list:
      select_item_list ',' select_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_select_item_list, p);
      }
    | select_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_item_list, "", p);
      }
    | '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_select_item_list, "", p);
      }
    ;

select_item:
      remember_name select_item2 remember_end select_alias
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_select_item, "", p);
      }
    ;

remember_name:
      /* empty */
      {
        $$= NULL;
      }
    ;

remember_end:
      /* empty */
      {
        $$= NULL;
      }
    ;

select_item2:
      table_wild
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_item2, "", p);
      }
    | expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_item2, "", p);
      }
    ;

select_alias:
      /* empty */
      {
        $$= NULL;
      }
    | AS ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AS));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_alias, "", p);
      }
    | AS TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AS));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_alias, "", p);
      }
    | ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_alias, "", p);
      }
    | TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_alias, "", p);
      }
    ;

optional_braces:
      /* empty */
      {
        $$= NULL;
      }
    | '(' ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_optional_braces, "", p);
      }
    ;

expr:
      expr or expr %prec OR_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | expr XOR expr %prec XOR
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_XOR));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | expr and expr %prec AND_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | NOT_SYM expr %prec NOT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NOT_SYM));
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri IS TRUE_SYM %prec IS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TRUE_SYM));
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri IS not TRUE_SYM %prec IS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_TRUE_SYM));
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri IS FALSE_SYM %prec IS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FALSE_SYM));
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri IS not FALSE_SYM %prec IS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FALSE_SYM));
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri IS UNKNOWN_SYM %prec IS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_UNKNOWN_SYM));
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri IS not UNKNOWN_SYM %prec IS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_UNKNOWN_SYM));
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    | bool_pri
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_expr, "", p);
      }
    ;

bool_pri:
      bool_pri IS NULL_SYM %prec IS
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_NULL_SYM));
        $$= mysql_parser::tree_item_reuse($1, sql::_bool_pri, p);
      }
    | bool_pri IS not NULL_SYM %prec IS
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IS));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_NULL_SYM));
        $$= mysql_parser::tree_item_reuse($1, sql::_bool_pri, p);
      }
    | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQUAL_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_bool_pri, p);
      }
    | bool_pri comp_op predicate %prec EQ
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_bool_pri, p);
      }
    | bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::tree_item_reuse($1, sql::_bool_pri, p);
      }
    | predicate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_bool_pri, "", p);
      }
    ;

predicate:
      bit_expr IN_SYM '(' subselect ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr not IN_SYM '(' subselect ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr IN_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr IN_SYM '(' expr ',' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_44));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr not IN_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr not IN_SYM '(' expr ',' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BETWEEN_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_AND_SYM));
        mysql_parser::tree_item_list_add_all(p, $5);
        mysql_parser::delete_tree_item($5);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BETWEEN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_AND_SYM));
        mysql_parser::tree_item_list_add_all(p, $6);
        mysql_parser::delete_tree_item($6);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr SOUNDS_SYM LIKE bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SOUNDS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LIKE));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr LIKE simple_expr opt_escape
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LIKE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr not LIKE simple_expr opt_escape
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LIKE));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr REGEXP bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_REGEXP));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr not REGEXP bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_REGEXP));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    | bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_predicate, "", p);
      }
    ;

bit_expr:
      bit_expr '|' bit_expr %prec '|'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_124));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '&' bit_expr %prec '&'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_38));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SHIFT_LEFT));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SHIFT_RIGHT));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '+' bit_expr %prec '+'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_43));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '-' bit_expr %prec '-'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_45));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '+' INTERVAL_SYM expr interval %prec '+'
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_43));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::tree_item_reuse($1, sql::_bit_expr, p);
      }
    | bit_expr '-' INTERVAL_SYM expr interval %prec '-'
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_45));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::tree_item_reuse($1, sql::_bit_expr, p);
      }
    | bit_expr '*' bit_expr %prec '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_42));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '/' bit_expr %prec '/'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_47));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '%' bit_expr %prec '%'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_37));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr DIV_SYM bit_expr %prec DIV_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DIV_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr MOD_SYM bit_expr %prec MOD_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MOD_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | bit_expr '^' bit_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_94));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    | simple_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_bit_expr, "", p);
      }
    ;

or:
      OR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_or);
      }
    | OR2_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_or);
      }
    ;

and:
      AND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_and);
      }
    | AND_AND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_and);
      }
    ;

not:
      NOT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_not);
      }
    | NOT2_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_not);
      }
    ;

not2:
      '!'
      {
        $$= mysql_parser::set_item_name($1, sql::_not2);
      }
    | NOT2_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_not2);
      }
    ;

comp_op:
      EQ
      {
        $$= mysql_parser::set_item_name($1, sql::_comp_op);
      }
    | GE
      {
        $$= mysql_parser::set_item_name($1, sql::_comp_op);
      }
    | GT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_comp_op);
      }
    | LE
      {
        $$= mysql_parser::set_item_name($1, sql::_comp_op);
      }
    | LT
      {
        $$= mysql_parser::set_item_name($1, sql::_comp_op);
      }
    | NE
      {
        $$= mysql_parser::set_item_name($1, sql::_comp_op);
      }
    ;

all_or_any:
      ALL
      {
        $$= mysql_parser::set_item_name($1, sql::_all_or_any);
      }
    | ANY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_all_or_any);
      }
    ;

simple_expr:
      simple_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | function_call_keyword
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | function_call_nonkeyword
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | function_call_generic
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | function_call_conflict
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | simple_expr COLLATE_SYM ident_or_text %prec NEG
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COLLATE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_simple_expr, p);
      }
    | literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | param_marker
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | variable
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | sum_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | simple_expr OR_OR_SYM simple_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_OR_OR_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '+' simple_expr %prec NEG
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_43));
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '-' simple_expr %prec NEG
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_45));
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '~' simple_expr %prec NEG
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_126));
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | not2 simple_expr %prec NEG
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '(' subselect ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '(' expr ',' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_44));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | ROW_SYM '(' expr ',' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ROW_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | EXISTS '(' subselect ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EXISTS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | '{' ident expr '}'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_123));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_125));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MATCH));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_AGAINST));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | BINARY simple_expr %prec NEG
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINARY));
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | CAST_SYM '(' expr AS cast_type ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CAST_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_AS));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | CASE_SYM opt_expr when_list opt_else END
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CASE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_END));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | CONVERT_SYM '(' expr ',' cast_type ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONVERT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | CONVERT_SYM '(' expr USING charset_name ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONVERT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_USING));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | DEFAULT '(' simple_ident ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFAULT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | VALUES '(' simple_ident_nospvar ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VALUES));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_43));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_simple_expr, "", p);
      }
    ;

function_call_keyword:
      CHAR_SYM '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | CHAR_SYM '(' expr_list USING charset_name ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_USING));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | CURRENT_USER optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CURRENT_USER));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | DATE_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | DAY_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DAY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | HOUR_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HOUR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | INSERT '(' expr ',' expr ',' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INSERT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_44));
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($10, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | LEFT '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LEFT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | MINUTE_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MINUTE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | MONTH_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MONTH_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | RIGHT '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RIGHT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | SECOND_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SECOND_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TIME_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIME_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TIMESTAMP '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIMESTAMP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TIMESTAMP '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIMESTAMP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' LEADING expr FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LEADING));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' TRAILING expr FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TRAILING));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' BOTH expr FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BOTH));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' LEADING FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LEADING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' TRAILING FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TRAILING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' BOTH FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BOTH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | TRIM '(' expr FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | USER '(' ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    | YEAR_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_YEAR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_keyword, "", p);
      }
    ;

function_call_nonkeyword:
      ADDDATE_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADDDATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ADDDATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | CURDATE optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CURDATE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | CURTIME optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CURTIME));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | CURTIME '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CURTIME));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATE_ADD_INTERVAL));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATE_SUB_INTERVAL));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | EXTRACT_SYM '(' interval FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EXTRACT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | GET_FORMAT '(' date_time_type ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GET_FORMAT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | NOW_SYM optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NOW_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | NOW_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NOW_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | POSITION_SYM '(' bit_expr IN_SYM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_POSITION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SUBDATE_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBDATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBDATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_INTERVAL_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SUBSTRING '(' expr ',' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBSTRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SUBSTRING '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBSTRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBSTRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SUBSTRING '(' expr FROM expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBSTRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SYSDATE optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SYSDATE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | SYSDATE '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SYSDATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | TIMESTAMP_ADD '(' interval_time_st ',' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIMESTAMP_ADD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | TIMESTAMP_DIFF '(' interval_time_st ',' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIMESTAMP_DIFF));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | UTC_DATE_SYM optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UTC_DATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | UTC_TIME_SYM optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UTC_TIME_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    | UTC_TIMESTAMP_SYM optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UTC_TIMESTAMP_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_function_call_nonkeyword, "", p);
      }
    ;

function_call_conflict:
      ASCII_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ASCII_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | CHARSET '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHARSET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | COALESCE '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COALESCE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | COLLATION_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COLLATION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | DATABASE '(' ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | IF '(' expr ',' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IF));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | MICROSECOND_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MICROSECOND_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | MOD_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MOD_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | OLD_PASSWORD '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OLD_PASSWORD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | PASSWORD '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | QUARTER_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_QUARTER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | REPEAT_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPEAT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | REPLACE '(' expr ',' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPLACE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_44));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | TRUNCATE_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRUNCATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | WEEK_SYM '(' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WEEK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | WEEK_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WEEK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    | geometry_function
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_function_call_conflict, "", p);
      }
    ;

geometry_function:
      CONTAINS_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONTAINS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | GEOMETRYCOLLECTION '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GEOMETRYCOLLECTION));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | LINESTRING '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LINESTRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | MULTILINESTRING '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MULTILINESTRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | MULTIPOINT '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MULTIPOINT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | MULTIPOLYGON '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MULTIPOLYGON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | POINT_SYM '(' expr ',' expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_POINT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    | POLYGON '(' expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_POLYGON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_geometry_function, "", p);
      }
    ;

function_call_generic:
      IDENT_sys '(' opt_udf_expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_generic, "", p);
      }
    | ident '.' ident '(' opt_expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_function_call_generic, "", p);
      }
    ;

fulltext_options:
      opt_natural_language_mode opt_query_expansion
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_fulltext_options, "", p);
      }
    | IN_SYM BOOLEAN_SYM MODE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BOOLEAN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_MODE_SYM));
        $$= mysql_parser::new_tree_item(sql::_fulltext_options, "", p);
      }
    ;

opt_natural_language_mode:
      /* empty */
      {
        $$= NULL;
      }
    | IN_SYM NATURAL LANGUAGE_SYM MODE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NATURAL));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LANGUAGE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_MODE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_natural_language_mode, "", p);
      }
    ;

opt_query_expansion:
      /* empty */
      {
        $$= NULL;
      }
    | WITH QUERY_SYM EXPANSION_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_QUERY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_EXPANSION_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_query_expansion, "", p);
      }
    ;

opt_udf_expr_list:
      /* empty */
      {
        $$= NULL;
      }
    | udf_expr_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_udf_expr_list, "", p);
      }
    ;

udf_expr_list:
      udf_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_udf_expr_list, "", p);
      }
    | udf_expr_list ',' udf_expr
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_udf_expr_list, p);
      }
    ;

udf_expr:
      remember_name expr remember_end select_alias
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_udf_expr, "", p);
      }
    ;

sum_expr:
      AVG_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AVG_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | AVG_SYM '(' DISTINCT in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AVG_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DISTINCT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | BIT_AND '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BIT_AND));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | BIT_OR '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BIT_OR));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | BIT_XOR '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BIT_XOR));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | COUNT_SYM '(' opt_all '*' ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COUNT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_42));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | COUNT_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COUNT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | COUNT_SYM '(' DISTINCT expr_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COUNT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DISTINCT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | MIN_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MIN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | MIN_SYM '(' DISTINCT in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MIN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DISTINCT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | MAX_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | MAX_SYM '(' DISTINCT in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DISTINCT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | STD_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STD_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | VARIANCE_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VARIANCE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | STDDEV_SAMP_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STDDEV_SAMP_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | VAR_SAMP_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VAR_SAMP_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | SUM_SYM '(' in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUM_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | SUM_SYM '(' DISTINCT in_sum_expr ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUM_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DISTINCT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    | GROUP_CONCAT_SYM '(' opt_distinct expr_list opt_gorder_clause opt_gconcat_separator ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GROUP_CONCAT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_sum_expr, "", p);
      }
    ;

variable:
      '@' variable_aux
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_variable, "", p);
      }
    ;

variable_aux:
      ident_or_text SET_VAR expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SET_VAR));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_variable_aux, "", p);
      }
    | ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_variable_aux, "", p);
      }
    | '@' opt_var_ident_type ident_or_text opt_component
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_variable_aux, "", p);
      }
    ;

opt_distinct:
      /* empty */
      {
        $$= NULL;
      }
    | DISTINCT
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_distinct);
      }
    ;

opt_gconcat_separator:
      /* empty */
      {
        $$= NULL;
      }
    | SEPARATOR_SYM text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SEPARATOR_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_gconcat_separator, "", p);
      }
    ;

opt_gorder_clause:
      /* empty */
      {
        $$= NULL;
      }
    | order_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_gorder_clause, "", p);
      }
    ;

in_sum_expr:
      opt_all expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_in_sum_expr, "", p);
      }
    ;

cast_type:
      BINARY opt_len
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINARY));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | CHAR_SYM opt_len opt_binary
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CHAR_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | NCHAR_SYM opt_len
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NCHAR_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | SIGNED_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SIGNED_SYM));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | SIGNED_SYM INT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SIGNED_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_INT_SYM));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | UNSIGNED
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNSIGNED));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | UNSIGNED INT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNSIGNED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_INT_SYM));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | DATE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATE_SYM));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | TIME_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIME_SYM));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | DATETIME
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATETIME));
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    | DECIMAL_SYM float_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DECIMAL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_cast_type, "", p);
      }
    ;

opt_expr_list:
      /* empty */
      {
        $$= NULL;
      }
    | expr_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_expr_list, "", p);
      }
    ;

expr_list:
      expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_expr_list, "", p);
      }
    | expr_list ',' expr
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_expr_list, p);
      }
    ;

ident_list_arg:
      ident_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ident_list_arg, "", p);
      }
    | '(' ident_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_ident_list_arg, "", p);
      }
    ;

ident_list:
      simple_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ident_list, "", p);
      }
    | ident_list ',' simple_ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_ident_list, p);
      }
    ;

opt_expr:
      /* empty */
      {
        $$= NULL;
      }
    | expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_expr, "", p);
      }
    ;

opt_else:
      /* empty */
      {
        $$= NULL;
      }
    | ELSE expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ELSE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_else, "", p);
      }
    ;

when_list:
      WHEN_SYM expr THEN_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WHEN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_THEN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_when_list, "", p);
      }
    | when_list WHEN_SYM expr THEN_SYM expr
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_WHEN_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_THEN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::tree_item_reuse($1, sql::_when_list, p);
      }
    ;

table_ref:
      table_factor
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_ref, "", p);
      }
    | join_table
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_ref, "", p);
      }
    ;

join_table_list:
      derived_table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_join_table_list, "", p);
      }
    ;

derived_table_list:
      table_ref
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_derived_table_list, "", p);
      }
    | derived_table_list ',' table_ref
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_derived_table_list, p);
      }
    ;

join_table:
      table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref STRAIGHT_JOIN table_factor
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STRAIGHT_JOIN));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref normal_join table_ref ON expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_ON));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref STRAIGHT_JOIN table_factor ON expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STRAIGHT_JOIN));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_ON));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref normal_join table_ref USING '(' using_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_USING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_40));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref NATURAL JOIN_SYM table_factor
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NATURAL));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref LEFT opt_outer JOIN_SYM table_ref ON expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LEFT));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_ON));
        mysql_parser::tree_item_list_add(p, $7);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref LEFT opt_outer JOIN_SYM table_factor USING '(' using_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LEFT));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_USING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_40));
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($9, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NATURAL));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LEFT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref RIGHT opt_outer JOIN_SYM table_ref ON expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_RIGHT));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_ON));
        mysql_parser::tree_item_list_add(p, $7);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref RIGHT opt_outer JOIN_SYM table_factor USING '(' using_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_RIGHT));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_USING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_40));
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($9, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    | table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NATURAL));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_RIGHT));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_join_table, "", p);
      }
    ;

normal_join:
      JOIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_JOIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_normal_join, "", p);
      }
    | INNER_SYM JOIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INNER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_JOIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_normal_join, "", p);
      }
    | CROSS JOIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CROSS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_JOIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_normal_join, "", p);
      }
    ;

table_factor:
      table_ident opt_table_alias opt_key_definition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_table_factor, "", p);
      }
    | '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_123));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_LEFT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_OUTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_JOIN_SYM));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($8, sql::_ON));
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($10, sql::_125));
        $$= mysql_parser::new_tree_item(sql::_table_factor, "", p);
      }
    | select_derived_init get_select_lex select_derived2
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_table_factor, "", p);
      }
    | '(' get_select_lex select_derived union_opt ')' opt_table_alias
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_table_factor, "", p);
      }
    ;

select_derived:
      get_select_lex derived_table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_derived, "", p);
      }
    ;

select_derived2:
      select_options select_item_list opt_select_from
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_select_derived2, "", p);
      }
    ;

get_select_lex:
      /* empty */
      {
        $$= NULL;
      }
    ;

select_derived_init:
      SELECT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_select_derived_init);
      }
    ;

opt_outer:
      /* empty */
      {
        $$= NULL;
      }
    | OUTER
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_outer);
      }
    ;

index_hint_clause:
      /* empty */
      {
        $$= NULL;
      }
    | FOR_SYM JOIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_JOIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_index_hint_clause, "", p);
      }
    | FOR_SYM ORDER_SYM BY
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ORDER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BY));
        $$= mysql_parser::new_tree_item(sql::_index_hint_clause, "", p);
      }
    | FOR_SYM GROUP_SYM BY
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_GROUP_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BY));
        $$= mysql_parser::new_tree_item(sql::_index_hint_clause, "", p);
      }
    ;

index_hint_type:
      FORCE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_index_hint_type);
      }
    | IGNORE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_index_hint_type);
      }
    ;

index_hint_definition:
      index_hint_type key_or_index index_hint_clause '(' key_usage_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_index_hint_definition, "", p);
      }
    | USE_SYM key_or_index index_hint_clause '(' opt_key_usage_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_index_hint_definition, "", p);
      }
    ;

index_hints_list:
      index_hint_definition
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_index_hints_list, "", p);
      }
    | index_hints_list index_hint_definition
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_index_hints_list, p);
      }
    ;

opt_index_hints_list:
      /* empty */
      {
        $$= NULL;
      }
    | index_hints_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_index_hints_list, "", p);
      }
    ;

opt_key_definition:
      opt_index_hints_list
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_key_definition);
      }
    ;

opt_key_usage_list:
      /* empty */
      {
        $$= NULL;
      }
    | key_usage_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_key_usage_list, "", p);
      }
    ;

key_usage_element:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_key_usage_element);
      }
    | PRIMARY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_key_usage_element);
      }
    ;

key_usage_list:
      key_usage_element
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_key_usage_list, "", p);
      }
    | key_usage_list ',' key_usage_element
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_key_usage_list, p);
      }
    ;

using_list:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_using_list, "", p);
      }
    | using_list ',' ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_using_list, p);
      }
    ;

interval:
      interval_time_st
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | DAY_HOUR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | DAY_MICROSECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | DAY_MINUTE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | DAY_SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | HOUR_MICROSECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | HOUR_MINUTE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | HOUR_SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | MICROSECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | MINUTE_MICROSECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | MINUTE_SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | SECOND_MICROSECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    | YEAR_MONTH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval);
      }
    ;

interval_time_st:
      DAY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | WEEK_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | HOUR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | FRAC_SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | MINUTE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | MONTH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | QUARTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    | YEAR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_interval_time_st);
      }
    ;

date_time_type:
      DATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_date_time_type);
      }
    | TIME_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_date_time_type);
      }
    | DATETIME
      {
        $$= mysql_parser::set_item_name($1, sql::_date_time_type);
      }
    | TIMESTAMP
      {
        $$= mysql_parser::set_item_name($1, sql::_date_time_type);
      }
    ;

table_alias:
      /* empty */
      {
        $$= NULL;
      }
    | AS
      {
        $$= mysql_parser::set_item_name($1, sql::_table_alias);
      }
    | EQ
      {
        $$= mysql_parser::set_item_name($1, sql::_table_alias);
      }
    ;

opt_table_alias:
      /* empty */
      {
        $$= NULL;
      }
    | table_alias ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_table_alias, "", p);
      }
    ;

opt_all:
      /* empty */
      {
        $$= NULL;
      }
    | ALL
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_all);
      }
    ;

where_clause:
      /* empty */
      {
        $$= NULL;
      }
    | WHERE expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WHERE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_where_clause, "", p);
      }
    ;

having_clause:
      /* empty */
      {
        $$= NULL;
      }
    | HAVING expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HAVING));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_having_clause, "", p);
      }
    ;

opt_escape:
      ESCAPE_SYM simple_expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ESCAPE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_escape, "", p);
      }
    | /* empty */
      {
        $$= NULL;
      }
    ;

group_clause:
      /* empty */
      {
        $$= NULL;
      }
    | GROUP_SYM BY group_list olap_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GROUP_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_group_clause, "", p);
      }
    ;

group_list:
      group_list ',' order_ident order_dir
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::tree_item_reuse($1, sql::_group_list, p);
      }
    | order_ident order_dir
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_group_list, "", p);
      }
    ;

olap_opt:
      /* empty */
      {
        $$= NULL;
      }
    | WITH CUBE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CUBE_SYM));
        $$= mysql_parser::new_tree_item(sql::_olap_opt, "", p);
      }
    | WITH ROLLUP_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ROLLUP_SYM));
        $$= mysql_parser::new_tree_item(sql::_olap_opt, "", p);
      }
    ;

alter_order_clause:
      ORDER_SYM BY alter_order_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ORDER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_alter_order_clause, "", p);
      }
    ;

alter_order_list:
      alter_order_list ',' alter_order_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_alter_order_list, p);
      }
    | alter_order_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_alter_order_list, "", p);
      }
    ;

alter_order_item:
      simple_ident_nospvar order_dir
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_alter_order_item, "", p);
      }
    ;

opt_order_clause:
      /* empty */
      {
        $$= NULL;
      }
    | order_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_order_clause, "", p);
      }
    ;

order_clause:
      ORDER_SYM BY order_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ORDER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_order_clause, "", p);
      }
    ;

order_list:
      order_list ',' order_ident order_dir
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::tree_item_reuse($1, sql::_order_list, p);
      }
    | order_ident order_dir
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_order_list, "", p);
      }
    ;

order_dir:
      /* empty */
      {
        $$= NULL;
      }
    | ASC
      {
        $$= mysql_parser::set_item_name($1, sql::_order_dir);
      }
    | DESC
      {
        $$= mysql_parser::set_item_name($1, sql::_order_dir);
      }
    ;

opt_limit_clause_init:
      /* empty */
      {
        $$= NULL;
      }
    | limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_limit_clause_init, "", p);
      }
    ;

opt_limit_clause:
      /* empty */
      {
        $$= NULL;
      }
    | limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_limit_clause, "", p);
      }
    ;

limit_clause:
      LIMIT limit_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LIMIT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_limit_clause, "", p);
      }
    ;

limit_options:
      limit_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_limit_options, "", p);
      }
    | limit_option ',' limit_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_limit_options, "", p);
      }
    | limit_option OFFSET_SYM limit_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_OFFSET_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_limit_options, "", p);
      }
    ;

limit_option:
      param_marker
      {
        $$= mysql_parser::set_item_name($1, sql::_limit_option);
      }
    | ULONGLONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_limit_option);
      }
    | LONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_limit_option);
      }
    | NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_limit_option);
      }
    ;

delete_limit_clause:
      /* empty */
      {
        $$= NULL;
      }
    | LIMIT limit_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LIMIT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_delete_limit_clause, "", p);
      }
    ;

ulong_num:
      NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulong_num);
      }
    | HEX_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulong_num);
      }
    | LONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulong_num);
      }
    | ULONGLONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulong_num);
      }
    | DECIMAL_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulong_num);
      }
    | FLOAT_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulong_num);
      }
    ;

real_ulong_num:
      NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulong_num);
      }
    | HEX_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulong_num);
      }
    | LONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulong_num);
      }
    | ULONGLONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulong_num);
      }
    | dec_num_error
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulong_num);
      }
    ;

ulonglong_num:
      NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulonglong_num);
      }
    | ULONGLONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulonglong_num);
      }
    | LONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulonglong_num);
      }
    | DECIMAL_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulonglong_num);
      }
    | FLOAT_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_ulonglong_num);
      }
    ;

real_ulonglong_num:
      NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulonglong_num);
      }
    | ULONGLONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulonglong_num);
      }
    | LONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulonglong_num);
      }
    | dec_num_error
      {
        $$= mysql_parser::set_item_name($1, sql::_real_ulonglong_num);
      }
    ;

dec_num_error:
      dec_num
      {
        $$= mysql_parser::set_item_name($1, sql::_dec_num_error);
      }
    ;

dec_num:
      DECIMAL_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_dec_num);
      }
    | FLOAT_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_dec_num);
      }
    ;

procedure_clause:
      /* empty */
      {
        $$= NULL;
      }
    | PROCEDURE ident '(' procedure_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_40));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_procedure_clause, "", p);
      }
    ;

procedure_list:
      /* empty */
      {
        $$= NULL;
      }
    | procedure_list2
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_procedure_list, "", p);
      }
    ;

procedure_list2:
      procedure_list2 ',' procedure_item
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_procedure_list2, p);
      }
    | procedure_item
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_procedure_list2, "", p);
      }
    ;

procedure_item:
      remember_name expr remember_end
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_procedure_item, "", p);
      }
    ;

select_var_list_init:
      select_var_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_var_list_init, "", p);
      }
    ;

select_var_list:
      select_var_list ',' select_var_ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_select_var_list, p);
      }
    | select_var_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_var_list, "", p);
      }
    ;

select_var_ident:
      '@' ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_select_var_ident, "", p);
      }
    | ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_select_var_ident, "", p);
      }
    ;

into:
      INTO into_destination
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INTO));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_into, "", p);
      }
    ;

into_destination:
      OUTFILE TEXT_STRING_filesystem opt_field_term opt_line_term
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OUTFILE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_into_destination, "", p);
      }
    | DUMPFILE TEXT_STRING_filesystem
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DUMPFILE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_into_destination, "", p);
      }
    | select_var_list_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_into_destination, "", p);
      }
    ;

do:
      DO_SYM expr_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DO_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_do, "", p);
      }
    ;

drop:
      DROP opt_temporary table_or_tables if_exists table_list opt_restrict
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP INDEX_SYM ident ON table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_INDEX_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_ON));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP DATABASE if_exists ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP FUNCTION_SYM if_exists ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_46));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP FUNCTION_SYM if_exists ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP PROCEDURE if_exists sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP USER clear_privileges user_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_USER));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP VIEW_SYM if_exists table_list opt_restrict
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VIEW_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP EVENT_SYM if_exists sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EVENT_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP TRIGGER_SYM if_exists sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TRIGGER_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP TABLESPACE tablespace_name opt_ts_engine opt_ts_wait
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLESPACE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP LOGFILE_SYM GROUP_SYM logfile_group_name opt_ts_engine opt_ts_wait
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOGFILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_GROUP_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    | DROP SERVER_SYM if_exists ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SERVER_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_drop, "", p);
      }
    ;

table_list:
      table_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_list, "", p);
      }
    | table_list ',' table_name
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_table_list, p);
      }
    ;

table_name:
      table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_name, "", p);
      }
    ;

table_alias_ref_list:
      table_alias_ref
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_alias_ref_list, "", p);
      }
    | table_alias_ref_list ',' table_alias_ref
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_table_alias_ref_list, p);
      }
    ;

table_alias_ref:
      table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_alias_ref, "", p);
      }
    ;

if_exists:
      /* empty */
      {
        $$= NULL;
      }
    | IF EXISTS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IF));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EXISTS));
        $$= mysql_parser::new_tree_item(sql::_if_exists, "", p);
      }
    ;

opt_temporary:
      /* empty */
      {
        $$= NULL;
      }
    | TEMPORARY
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_temporary);
      }
    ;

insert:
      INSERT insert_lock_option opt_ignore insert2 insert_field_spec opt_insert_update
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INSERT));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_insert, "", p);
      }
    ;

replace:
      REPLACE replace_lock_option insert2 insert_field_spec
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPLACE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_replace, "", p);
      }
    ;

insert_lock_option:
      /* empty */
      {
        $$= NULL;
      }
    | LOW_PRIORITY
      {
        $$= mysql_parser::set_item_name($1, sql::_insert_lock_option);
      }
    | DELAYED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_insert_lock_option);
      }
    | HIGH_PRIORITY
      {
        $$= mysql_parser::set_item_name($1, sql::_insert_lock_option);
      }
    ;

replace_lock_option:
      opt_low_priority
      {
        $$= mysql_parser::set_item_name($1, sql::_replace_lock_option);
      }
    | DELAYED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_replace_lock_option);
      }
    ;

insert2:
      INTO insert_table
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INTO));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_insert2, "", p);
      }
    | insert_table
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_insert2, "", p);
      }
    ;

insert_table:
      table_name
      {
        $$= mysql_parser::set_item_name($1, sql::_insert_table);
      }
    ;

insert_field_spec:
      insert_values
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_insert_field_spec, "", p);
      }
    | '(' ')' insert_values
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_41));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_insert_field_spec, "", p);
      }
    | '(' fields ')' insert_values
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_insert_field_spec, "", p);
      }
    | SET ident_eq_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SET));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_insert_field_spec, "", p);
      }
    ;

fields:
      fields ',' insert_ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_fields, p);
      }
    | insert_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_fields, "", p);
      }
    ;

insert_values:
      VALUES values_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VALUES));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_insert_values, "", p);
      }
    | VALUE_SYM values_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_VALUE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_insert_values, "", p);
      }
    | create_select union_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_insert_values, "", p);
      }
    | '(' create_select ')' union_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_insert_values, "", p);
      }
    ;

values_list:
      values_list ',' no_braces
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_values_list, p);
      }
    | no_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_values_list, "", p);
      }
    ;

ident_eq_list:
      ident_eq_list ',' ident_eq_value
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_ident_eq_list, p);
      }
    | ident_eq_value
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ident_eq_list, "", p);
      }
    ;

ident_eq_value:
      simple_ident_nospvar equal expr_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_ident_eq_value, "", p);
      }
    ;

equal:
      EQ
      {
        $$= mysql_parser::set_item_name($1, sql::_equal);
      }
    | SET_VAR
      {
        $$= mysql_parser::set_item_name($1, sql::_equal);
      }
    ;

opt_equal:
      /* empty */
      {
        $$= NULL;
      }
    | equal
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_equal);
      }
    ;

no_braces:
      '(' opt_values ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_no_braces, "", p);
      }
    ;

opt_values:
      /* empty */
      {
        $$= NULL;
      }
    | values
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_values, "", p);
      }
    ;

values:
      values ',' expr_or_default
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_values, p);
      }
    | expr_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_values, "", p);
      }
    ;

expr_or_default:
      expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_expr_or_default, "", p);
      }
    | DEFAULT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFAULT));
        $$= mysql_parser::new_tree_item(sql::_expr_or_default, "", p);
      }
    ;

opt_insert_update:
      /* empty */
      {
        $$= NULL;
      }
    | ON DUPLICATE_SYM KEY_SYM UPDATE_SYM insert_update_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DUPLICATE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_KEY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_UPDATE_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_opt_insert_update, "", p);
      }
    ;

update:
      UPDATE_SYM opt_low_priority opt_ignore join_table_list SET update_list where_clause opt_order_clause delete_limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UPDATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_SET));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, $9);
        $$= mysql_parser::new_tree_item(sql::_update, "", p);
      }
    ;

update_list:
      update_list ',' update_elem
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_update_list, p);
      }
    | update_elem
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_update_list, "", p);
      }
    ;

update_elem:
      simple_ident_nospvar equal expr_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_update_elem, "", p);
      }
    ;

insert_update_list:
      insert_update_list ',' insert_update_elem
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_insert_update_list, p);
      }
    | insert_update_elem
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_insert_update_list, "", p);
      }
    ;

insert_update_elem:
      simple_ident_nospvar equal expr_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_insert_update_elem, "", p);
      }
    ;

opt_low_priority:
      /* empty */
      {
        $$= NULL;
      }
    | LOW_PRIORITY
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_low_priority);
      }
    ;

delete:
      DELETE_SYM opt_delete_options single_multi
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DELETE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_delete, "", p);
      }
    ;

single_multi:
      FROM table_ident where_clause opt_order_clause delete_limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_single_multi, "", p);
      }
    | table_wild_list FROM join_table_list where_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_single_multi, "", p);
      }
    | FROM table_alias_ref_list USING join_table_list where_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_USING));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_single_multi, "", p);
      }
    ;

table_wild_list:
      table_wild_one
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_wild_list, "", p);
      }
    | table_wild_list ',' table_wild_one
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_table_wild_list, p);
      }
    ;

table_wild_one:
      ident opt_wild opt_table_alias
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_table_wild_one, "", p);
      }
    | ident '.' ident opt_wild opt_table_alias
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_table_wild_one, "", p);
      }
    ;

opt_wild:
      /* empty */
      {
        $$= NULL;
      }
    | '.' '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_46));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_opt_wild, "", p);
      }
    ;

opt_delete_options:
      /* empty */
      {
        $$= NULL;
      }
    | opt_delete_option opt_delete_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add_all(p, $2);
        mysql_parser::delete_tree_item($2);
        $$= mysql_parser::new_tree_item(sql::_opt_delete_options, "", p);
      }
    ;

opt_delete_option:
      QUICK
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_delete_option);
      }
    | LOW_PRIORITY
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_delete_option);
      }
    | IGNORE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_delete_option);
      }
    ;

truncate:
      TRUNCATE_SYM opt_table_sym table_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRUNCATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_truncate, "", p);
      }
    ;

opt_table_sym:
      /* empty */
      {
        $$= NULL;
      }
    | TABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_table_sym);
      }
    ;

show:
      SHOW show_param
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SHOW));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_show, "", p);
      }
    ;

show_param:
      DATABASES wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATABASES));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_full TABLES opt_db wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLES));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_full TRIGGERS_SYM opt_db wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TRIGGERS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | EVENTS_SYM opt_db wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EVENTS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | TABLE_SYM STATUS_SYM opt_db wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | OPEN_SYM TABLES opt_db wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OPEN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLES));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_full PLUGIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PLUGIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | PLUGINS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PLUGINS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | ENGINE_SYM known_storage_engines show_engine_param
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENGINE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | ENGINE_SYM ALL show_engine_param
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENGINE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ALL));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COLUMNS));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num AND_SYM MASTER_SERVER_ID_SYM EQ ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NEW_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MASTER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_MASTER_LOG_FILE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($9, sql::_AND_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($10, sql::_MASTER_LOG_POS_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($11, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $12);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($13, sql::_AND_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($14, sql::_MASTER_SERVER_ID_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($15, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $16);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | master_or_binary LOGS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOGS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | SLAVE HOSTS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_HOSTS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | BINLOG_SYM EVENTS_SYM binlog_in binlog_from opt_limit_clause_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINLOG_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EVENTS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | keys_or_index from_or_in table_ident opt_db where_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | COLUMN_SYM TYPES_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COLUMN_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TYPES_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | TABLE_SYM TYPES_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TYPES_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_storage ENGINES_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ENGINES_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | AUTHORS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AUTHORS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CONTRIBUTORS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CONTRIBUTORS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | PRIVILEGES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PRIVILEGES));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | COUNT_SYM '(' '*' ')' WARNINGS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COUNT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_42));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_WARNINGS));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | COUNT_SYM '(' '*' ')' ERRORS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COUNT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_42));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_ERRORS));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | WARNINGS opt_limit_clause_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WARNINGS));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | ERRORS opt_limit_clause_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ERRORS));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_var_type STATUS_SYM wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | INNOBASE_SYM STATUS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INNOBASE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | MUTEX_SYM STATUS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MUTEX_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_full PROCESSLIST_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PROCESSLIST_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | opt_var_type VARIABLES wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VARIABLES));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | charset wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | COLLATION_SYM wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COLLATION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | GRANTS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GRANTS));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | GRANTS FOR_SYM user
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GRANTS));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE DATABASE opt_if_not_exists ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATABASE));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE TABLE_SYM table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE VIEW_SYM table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VIEW_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | MASTER_SYM STATUS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | SLAVE STATUS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SLAVE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE PROCEDURE sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE FUNCTION_SYM sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE TRIGGER_SYM sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TRIGGER_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | PROCEDURE STATUS_SYM wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | FUNCTION_SYM STATUS_SYM wild_and_where
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_STATUS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | PROCEDURE CODE_SYM sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CODE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | FUNCTION_SYM CODE_SYM sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CODE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    | CREATE EVENT_SYM sp_name
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EVENT_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_show_param, "", p);
      }
    ;

show_engine_param:
      STATUS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_show_engine_param);
      }
    | MUTEX_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_show_engine_param);
      }
    | LOGS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_show_engine_param);
      }
    ;

master_or_binary:
      MASTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_master_or_binary);
      }
    | BINARY
      {
        $$= mysql_parser::set_item_name($1, sql::_master_or_binary);
      }
    ;

opt_storage:
      /* empty */
      {
        $$= NULL;
      }
    | STORAGE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_storage);
      }
    ;

opt_db:
      /* empty */
      {
        $$= NULL;
      }
    | from_or_in ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_db, "", p);
      }
    ;

opt_full:
      /* empty */
      {
        $$= NULL;
      }
    | FULL
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_full);
      }
    ;

from_or_in:
      FROM
      {
        $$= mysql_parser::set_item_name($1, sql::_from_or_in);
      }
    | IN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_from_or_in);
      }
    ;

binlog_in:
      /* empty */
      {
        $$= NULL;
      }
    | IN_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_binlog_in, "", p);
      }
    ;

binlog_from:
      /* empty */
      {
        $$= NULL;
      }
    | FROM ulonglong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_binlog_from, "", p);
      }
    ;

wild_and_where:
      /* empty */
      {
        $$= NULL;
      }
    | LIKE TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LIKE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_wild_and_where, "", p);
      }
    | WHERE expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WHERE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_wild_and_where, "", p);
      }
    ;

describe:
      describe_command table_ident opt_describe_column
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_describe, "", p);
      }
    | describe_command opt_extended_describe select
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_describe, "", p);
      }
    ;

describe_command:
      DESC
      {
        $$= mysql_parser::set_item_name($1, sql::_describe_command);
      }
    | DESCRIBE
      {
        $$= mysql_parser::set_item_name($1, sql::_describe_command);
      }
    ;

opt_extended_describe:
      /* empty */
      {
        $$= NULL;
      }
    | EXTENDED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_extended_describe);
      }
    | PARTITIONS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_extended_describe);
      }
    ;

opt_describe_column:
      /* empty */
      {
        $$= NULL;
      }
    | text_string
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_describe_column);
      }
    | ident
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_describe_column);
      }
    ;

flush:
      FLUSH_SYM opt_no_write_to_binlog flush_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FLUSH_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_flush, "", p);
      }
    ;

flush_options:
      flush_options ',' flush_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_flush_options, p);
      }
    | flush_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_flush_options, "", p);
      }
    ;

flush_option:
      table_or_tables opt_table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | TABLES WITH READ_SYM LOCK_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TABLES));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_READ_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_LOCK_SYM));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | QUERY_SYM CACHE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_QUERY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CACHE_SYM));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | HOSTS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HOSTS_SYM));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | PRIVILEGES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PRIVILEGES));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | LOGS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOGS_SYM));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | STATUS_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STATUS_SYM));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | SLAVE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SLAVE));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | MASTER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SYM));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | DES_KEY_FILE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DES_KEY_FILE));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    | RESOURCES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RESOURCES));
        $$= mysql_parser::new_tree_item(sql::_flush_option, "", p);
      }
    ;

opt_table_list:
      /* empty */
      {
        $$= NULL;
      }
    | table_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_opt_table_list, "", p);
      }
    ;

reset:
      RESET_SYM reset_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RESET_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_reset, "", p);
      }
    ;

reset_options:
      reset_options ',' reset_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_reset_options, p);
      }
    | reset_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_reset_options, "", p);
      }
    ;

reset_option:
      SLAVE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SLAVE));
        $$= mysql_parser::new_tree_item(sql::_reset_option, "", p);
      }
    | MASTER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MASTER_SYM));
        $$= mysql_parser::new_tree_item(sql::_reset_option, "", p);
      }
    | QUERY_SYM CACHE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_QUERY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CACHE_SYM));
        $$= mysql_parser::new_tree_item(sql::_reset_option, "", p);
      }
    ;

purge:
      PURGE purge_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PURGE));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_purge, "", p);
      }
    ;

purge_options:
      master_or_binary LOGS_SYM purge_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOGS_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_purge_options, "", p);
      }
    ;

purge_option:
      TO_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_purge_option, "", p);
      }
    | BEFORE_SYM expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BEFORE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_purge_option, "", p);
      }
    ;

kill:
      KILL_SYM kill_option expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_KILL_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_kill, "", p);
      }
    ;

kill_option:
      /* empty */
      {
        $$= NULL;
      }
    | CONNECTION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_kill_option);
      }
    | QUERY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_kill_option);
      }
    ;

use:
      USE_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_use, "", p);
      }
    ;

load:
      LOAD DATA_SYM load_data
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOAD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATA_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_load, "", p);
      }
    | LOAD TABLE_SYM table_ident FROM MASTER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOAD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_FROM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_MASTER_SYM));
        $$= mysql_parser::new_tree_item(sql::_load, "", p);
      }
    ;

load_data:
      load_data_lock opt_local INFILE TEXT_STRING_filesystem opt_duplicate INTO TABLE_SYM table_ident opt_load_data_charset opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec opt_load_data_set_spec
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INFILE));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_INTO));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_TABLE_SYM));
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, $10);
        mysql_parser::tree_item_list_add(p, $11);
        mysql_parser::tree_item_list_add(p, $12);
        mysql_parser::tree_item_list_add(p, $13);
        mysql_parser::tree_item_list_add(p, $14);
        $$= mysql_parser::new_tree_item(sql::_load_data, "", p);
      }
    | FROM MASTER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FROM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MASTER_SYM));
        $$= mysql_parser::new_tree_item(sql::_load_data, "", p);
      }
    ;

opt_local:
      /* empty */
      {
        $$= NULL;
      }
    | LOCAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_local);
      }
    ;

load_data_lock:
      /* empty */
      {
        $$= NULL;
      }
    | CONCURRENT
      {
        $$= mysql_parser::set_item_name($1, sql::_load_data_lock);
      }
    | LOW_PRIORITY
      {
        $$= mysql_parser::set_item_name($1, sql::_load_data_lock);
      }
    ;

opt_duplicate:
      /* empty */
      {
        $$= NULL;
      }
    | REPLACE
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_duplicate);
      }
    | IGNORE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_duplicate);
      }
    ;

opt_field_term:
      /* empty */
      {
        $$= NULL;
      }
    | COLUMNS field_term_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COLUMNS));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_field_term, "", p);
      }
    ;

field_term_list:
      field_term_list field_term
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_field_term_list, p);
      }
    | field_term
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_term_list, "", p);
      }
    ;

field_term:
      TERMINATED BY text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TERMINATED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_field_term, "", p);
      }
    | OPTIONALLY ENCLOSED BY text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OPTIONALLY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ENCLOSED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BY));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_field_term, "", p);
      }
    | ENCLOSED BY text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ENCLOSED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_field_term, "", p);
      }
    | ESCAPED BY text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ESCAPED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_field_term, "", p);
      }
    ;

opt_line_term:
      /* empty */
      {
        $$= NULL;
      }
    | LINES line_term_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LINES));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_line_term, "", p);
      }
    ;

line_term_list:
      line_term_list line_term
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_line_term_list, p);
      }
    | line_term
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_line_term_list, "", p);
      }
    ;

line_term:
      TERMINATED BY text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TERMINATED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_line_term, "", p);
      }
    | STARTING BY text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_STARTING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BY));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_line_term, "", p);
      }
    ;

opt_ignore_lines:
      /* empty */
      {
        $$= NULL;
      }
    | IGNORE_SYM NUM LINES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_IGNORE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NUM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_LINES));
        $$= mysql_parser::new_tree_item(sql::_opt_ignore_lines, "", p);
      }
    ;

opt_field_or_var_spec:
      /* empty */
      {
        $$= NULL;
      }
    | '(' fields_or_vars ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_field_or_var_spec, "", p);
      }
    | '(' ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_field_or_var_spec, "", p);
      }
    ;

fields_or_vars:
      fields_or_vars ',' field_or_var
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_fields_or_vars, p);
      }
    | field_or_var
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_fields_or_vars, "", p);
      }
    ;

field_or_var:
      simple_ident_nospvar
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_or_var, "", p);
      }
    | '@' ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_field_or_var, "", p);
      }
    ;

opt_load_data_set_spec:
      /* empty */
      {
        $$= NULL;
      }
    | SET insert_update_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SET));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_load_data_set_spec, "", p);
      }
    ;

text_literal:
      TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_text_literal, "", p);
      }
    | NCHAR_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NCHAR_STRING));
        $$= mysql_parser::new_tree_item(sql::_text_literal, "", p);
      }
    | UNDERSCORE_CHARSET TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNDERSCORE_CHARSET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_text_literal, "", p);
      }
    | text_literal TEXT_STRING_literal
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_text_literal, p);
      }
    ;

text_string:
      TEXT_STRING_literal
      {
        $$= mysql_parser::set_item_name($1, sql::_text_string);
      }
    | HEX_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_text_string);
      }
    | BIN_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_text_string);
      }
    ;

param_marker:
      PARAM_MARKER
      {
        $$= mysql_parser::set_item_name($1, sql::_param_marker);
      }
    ;

signed_literal:
      literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_signed_literal, "", p);
      }
    | '+' NUM_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_43));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_signed_literal, "", p);
      }
    | '-' NUM_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_45));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_signed_literal, "", p);
      }
    ;

literal:
      text_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | NUM_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | NULL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NULL_SYM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | FALSE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FALSE_SYM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | TRUE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRUE_SYM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | HEX_NUM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HEX_NUM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | BIN_NUM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BIN_NUM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | UNDERSCORE_CHARSET HEX_NUM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNDERSCORE_CHARSET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_HEX_NUM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | UNDERSCORE_CHARSET BIN_NUM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNDERSCORE_CHARSET));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_BIN_NUM));
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | DATE_SYM text_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | TIME_SYM text_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIME_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    | TIMESTAMP text_literal
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TIMESTAMP));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_literal, "", p);
      }
    ;

NUM_literal:
      NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_NUM_literal);
      }
    | LONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_NUM_literal);
      }
    | ULONGLONG_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_NUM_literal);
      }
    | DECIMAL_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_NUM_literal);
      }
    | FLOAT_NUM
      {
        $$= mysql_parser::set_item_name($1, sql::_NUM_literal);
      }
    ;

insert_ident:
      simple_ident_nospvar
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_insert_ident, "", p);
      }
    | table_wild
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_insert_ident, "", p);
      }
    ;

table_wild:
      ident '.' '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_table_wild, "", p);
      }
    | ident '.' ident '.' '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_46));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_table_wild, "", p);
      }
    ;

order_ident:
      expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_order_ident, "", p);
      }
    ;

simple_ident:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_ident, "", p);
      }
    | simple_ident_q
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_ident, "", p);
      }
    ;

simple_ident_nospvar:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_ident_nospvar, "", p);
      }
    | simple_ident_q
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_simple_ident_nospvar, "", p);
      }
    ;

simple_ident_q:
      ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_simple_ident_q, "", p);
      }
    | '.' ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_46));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_46));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_simple_ident_q, "", p);
      }
    | ident '.' ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_46));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_simple_ident_q, "", p);
      }
    ;

field_ident:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_field_ident, "", p);
      }
    | ident '.' ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_46));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_field_ident, "", p);
      }
    | ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_field_ident, "", p);
      }
    | '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_46));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_field_ident, "", p);
      }
    ;

table_ident:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_ident, "", p);
      }
    | ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_table_ident, "", p);
      }
    | '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_46));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_table_ident, "", p);
      }
    ;

table_ident_nodb:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_table_ident_nodb);
      }
    ;

IDENT_sys:
      IDENT
      {
        $$= mysql_parser::set_item_name($1, sql::_IDENT_sys);
      }
    | IDENT_QUOTED
      {
        $$= mysql_parser::set_item_name($1, sql::_IDENT_sys);
      }
    ;

TEXT_STRING_sys:
      TEXT_STRING
      {
        $$= mysql_parser::set_item_name($1, sql::_TEXT_STRING_sys);
      }
    ;

TEXT_STRING_literal:
      TEXT_STRING
      {
        $$= mysql_parser::set_item_name($1, sql::_TEXT_STRING_literal);
      }
    ;

TEXT_STRING_filesystem:
      TEXT_STRING
      {
        $$= mysql_parser::set_item_name($1, sql::_TEXT_STRING_filesystem);
      }
    ;

ident:
      IDENT_sys
      {
        $$= mysql_parser::set_item_name($1, sql::_ident);
      }
    | READ_ONLY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_ident);
      }
    | keyword
      {
        $$= mysql_parser::set_item_name($1, sql::_ident);
      }
    ;

label_ident:
      IDENT_sys
      {
        $$= mysql_parser::set_item_name($1, sql::_label_ident);
      }
    | keyword_sp
      {
        $$= mysql_parser::set_item_name($1, sql::_label_ident);
      }
    ;

ident_or_text:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_ident_or_text);
      }
    | TEXT_STRING_sys
      {
        $$= mysql_parser::set_item_name($1, sql::_ident_or_text);
      }
    | LEX_HOSTNAME
      {
        $$= mysql_parser::set_item_name($1, sql::_ident_or_text);
      }
    ;

user:
      ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_user, "", p);
      }
    | ident_or_text '@' ident_or_text
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_64));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_user, "", p);
      }
    | CURRENT_USER optional_braces
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CURRENT_USER));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_user, "", p);
      }
    ;

keyword:
      keyword_sp
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | ASCII_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | BACKUP_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | BEGIN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | BYTE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | CACHE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | CHARSET
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | CHECKSUM_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | CLOSE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | COMMENT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | COMMIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | CONTAINS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | DEALLOCATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | DO_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | END
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | EXECUTE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | FLUSH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | HANDLER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | HELP_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | HOST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | INSTALL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | LANGUAGE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | NO_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | OPEN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | OPTIONS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | OWNER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | PARSER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | PARTITION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | PORT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | PREPARE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | REMOVE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | REPAIR
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | RESET_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | RESTORE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | ROLLBACK_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SAVEPOINT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SECURITY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SERVER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SIGNED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SOCKET_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SLAVE
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | SONAME_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | START_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | STOP_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | TRUNCATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | UNICODE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | UNINSTALL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | WRAPPER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | XA_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    | UPGRADE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword);
      }
    ;

keyword_sp:
      ACTION
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ADDDATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AFTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AGAINST
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AGGREGATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ALGORITHM_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ANY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AUTHORS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AUTO_INC
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AUTOEXTEND_SIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AVG_ROW_LENGTH
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | AVG_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | BINLOG_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | BIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | BOOL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | BOOLEAN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | BTREE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CASCADED
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CHAIN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CHANGED
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CIPHER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CLIENT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COALESCE
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CODE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COLLATION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COLUMNS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COMMITTED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COMPACT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COMPLETION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | COMPRESSED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CONCURRENT
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CONNECTION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CONSISTENT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CONTRIBUTORS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | CUBE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DATA_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DATAFILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DATETIME
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DAY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DEFINER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DELAY_KEY_WRITE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DES_KEY_FILE
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DIRECTORY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DISABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DISCARD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DISK_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DUMPFILE
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DUPLICATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | DYNAMIC_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ENDS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ENUM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ENGINE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ENGINES_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ERRORS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ESCAPE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | EVENT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | EVENTS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | EVERY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | EXPANSION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | EXTENDED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | EXTENT_SIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FAST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FOUND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ENABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FULL
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FIRST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FIXED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FRAC_SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | GEOMETRY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | GEOMETRYCOLLECTION
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | GET_FORMAT
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | GRANTS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | GLOBAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | HASH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | HOSTS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | HOUR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | IDENTIFIED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | INVOKER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | IMPORT
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | INDEXES
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | INITIAL_SIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ISOLATION
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ISSUER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | INNOBASE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | INSERT_METHOD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | KEY_BLOCK_SIZE
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LAST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LEAVES
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LESS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LEVEL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LINESTRING
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LIST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LOCAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LOCKS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LOGFILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | LOGS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_ROWS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_HOST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_PORT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_LOG_FILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_LOG_POS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_USER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_PASSWORD_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SERVER_ID_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_CONNECT_RETRY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SSL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SSL_CA_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SSL_CAPATH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SSL_CERT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SSL_CIPHER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MASTER_SSL_KEY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_CONNECTIONS_PER_HOUR
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_QUERIES_PER_HOUR
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_SIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_UPDATES_PER_HOUR
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_USER_CONNECTIONS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MAX_VALUE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MEDIUM_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MEMORY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MERGE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MICROSECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MIGRATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MINUTE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MIN_ROWS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MODIFY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MODE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MONTH_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MULTILINESTRING
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MULTIPOINT
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MULTIPOLYGON
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | MUTEX_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NAME_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NAMES_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NATIONAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NCHAR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NDBCLUSTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NEXT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NEW_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NO_WAIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NODEGROUP_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NONE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | NVARCHAR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | OFFSET_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | OLD_PASSWORD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ONE_SHOT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ONE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PACK_KEYS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PAGE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PARTIAL
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PARTITIONING_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PARTITIONS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PASSWORD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PHASE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PLUGIN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PLUGINS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | POINT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | POLYGON
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PRESERVE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PREV_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PRIVILEGES
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PROCESS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | PROCESSLIST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | QUARTER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | QUERY_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | QUICK
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REBUILD_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RECOVER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REDO_BUFFER_SIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REDOFILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REDUNDANT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RELAY_LOG_FILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RELAY_LOG_POS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RELAY_THREAD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RELOAD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REORGANIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REPEATABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | REPLICATION
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RESOURCES
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RESUME_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RETURNS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ROLLUP_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ROUTINE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ROWS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ROW_FORMAT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | ROW_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | RTREE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SCHEDULE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SECOND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SERIAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SERIALIZABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SESSION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SIMPLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SHARE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SHUTDOWN
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SNAPSHOT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SOUNDS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SQL_CACHE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SQL_BUFFER_RESULT
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SQL_NO_CACHE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SQL_THREAD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | STARTS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | STATUS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | STORAGE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | STRING_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SUBDATE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SUBJECT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SUBPARTITION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SUBPARTITIONS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SUPER_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | SUSPEND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TABLES
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TABLESPACE
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TEMPORARY
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TEMPTABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TEXT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | THAN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TRANSACTION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TRANSACTIONAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TRIGGERS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TIMESTAMP
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TIMESTAMP_ADD
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TIMESTAMP_DIFF
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TIME_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TYPES_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | TYPE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UDF_RETURNS_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | FUNCTION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UNCOMMITTED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UNDEFINED_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UNDO_BUFFER_SIZE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UNDOFILE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UNKNOWN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | UNTIL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | USER
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | USE_FRM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | VARIABLES
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | VIEW_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | VALUE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | WARNINGS
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | WAIT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | WEEK_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | WORK_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | X509_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    | YEAR_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_keyword_sp);
      }
    ;

set:
      SET opt_option option_value_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SET));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_set, "", p);
      }
    ;

opt_option:
      /* empty */
      {
        $$= NULL;
      }
    | OPTION
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_option);
      }
    ;

option_value_list:
      option_type_value
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_option_value_list, "", p);
      }
    | option_value_list ',' option_type_value
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_option_value_list, p);
      }
    ;

option_type_value:
      ext_option_value
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_option_type_value, "", p);
      }
    ;

option_type:
      option_type2
      {
        $$= mysql_parser::set_item_name($1, sql::_option_type);
      }
    | GLOBAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_option_type);
      }
    | LOCAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_option_type);
      }
    | SESSION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_option_type);
      }
    ;

option_type2:
      /* empty */
      {
        $$= NULL;
      }
    | ONE_SHOT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_option_type2);
      }
    ;

opt_var_type:
      /* empty */
      {
        $$= NULL;
      }
    | GLOBAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_var_type);
      }
    | LOCAL_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_var_type);
      }
    | SESSION_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_var_type);
      }
    ;

opt_var_ident_type:
      /* empty */
      {
        $$= NULL;
      }
    | GLOBAL_SYM '.'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GLOBAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        $$= mysql_parser::new_tree_item(sql::_opt_var_ident_type, "", p);
      }
    | LOCAL_SYM '.'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOCAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        $$= mysql_parser::new_tree_item(sql::_opt_var_ident_type, "", p);
      }
    | SESSION_SYM '.'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SESSION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        $$= mysql_parser::new_tree_item(sql::_opt_var_ident_type, "", p);
      }
    ;

ext_option_value:
      sys_option_value
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_ext_option_value, "", p);
      }
    | option_type2 option_value
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_ext_option_value, "", p);
      }
    ;

sys_option_value:
      option_type internal_variable_name equal set_expr_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_sys_option_value, "", p);
      }
    | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TRANSACTION_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_ISOLATION));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_LEVEL_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_sys_option_value, "", p);
      }
    ;

option_value:
      '@' ident_or_text equal expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_64));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_64));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    | charset old_or_new_charset_name_or_default
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    | NAMES_SYM equal expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NAMES_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    | NAMES_SYM charset_name_or_default opt_collate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NAMES_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    | PASSWORD equal text_or_password
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    | PASSWORD FOR_SYM user equal text_or_password
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_option_value, "", p);
      }
    ;

internal_variable_name:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_internal_variable_name, "", p);
      }
    | ident '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_internal_variable_name, "", p);
      }
    | DEFAULT '.' ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFAULT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_internal_variable_name, "", p);
      }
    ;

isolation_types:
      READ_SYM UNCOMMITTED_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READ_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_UNCOMMITTED_SYM));
        $$= mysql_parser::new_tree_item(sql::_isolation_types, "", p);
      }
    | READ_SYM COMMITTED_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READ_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COMMITTED_SYM));
        $$= mysql_parser::new_tree_item(sql::_isolation_types, "", p);
      }
    | REPEATABLE_SYM READ_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPEATABLE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_READ_SYM));
        $$= mysql_parser::new_tree_item(sql::_isolation_types, "", p);
      }
    | SERIALIZABLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SERIALIZABLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_isolation_types, "", p);
      }
    ;

text_or_password:
      TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_text_or_password, "", p);
      }
    | PASSWORD '(' TEXT_STRING ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TEXT_STRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_text_or_password, "", p);
      }
    | OLD_PASSWORD '(' TEXT_STRING ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OLD_PASSWORD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TEXT_STRING));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_text_or_password, "", p);
      }
    ;

set_expr_or_default:
      expr
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_set_expr_or_default, "", p);
      }
    | DEFAULT
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFAULT));
        $$= mysql_parser::new_tree_item(sql::_set_expr_or_default, "", p);
      }
    | ON
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ON));
        $$= mysql_parser::new_tree_item(sql::_set_expr_or_default, "", p);
      }
    | ALL
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALL));
        $$= mysql_parser::new_tree_item(sql::_set_expr_or_default, "", p);
      }
    | BINARY
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BINARY));
        $$= mysql_parser::new_tree_item(sql::_set_expr_or_default, "", p);
      }
    ;

lock:
      LOCK_SYM table_or_tables table_lock_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOCK_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_lock, "", p);
      }
    ;

table_or_tables:
      TABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_table_or_tables);
      }
    | TABLES
      {
        $$= mysql_parser::set_item_name($1, sql::_table_or_tables);
      }
    ;

table_lock_list:
      table_lock
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_table_lock_list, "", p);
      }
    | table_lock_list ',' table_lock
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_table_lock_list, p);
      }
    ;

table_lock:
      table_ident opt_table_alias lock_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_table_lock, "", p);
      }
    ;

lock_option:
      READ_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READ_SYM));
        $$= mysql_parser::new_tree_item(sql::_lock_option, "", p);
      }
    | WRITE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WRITE_SYM));
        $$= mysql_parser::new_tree_item(sql::_lock_option, "", p);
      }
    | LOW_PRIORITY WRITE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOW_PRIORITY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_WRITE_SYM));
        $$= mysql_parser::new_tree_item(sql::_lock_option, "", p);
      }
    | READ_SYM LOCAL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_READ_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOCAL_SYM));
        $$= mysql_parser::new_tree_item(sql::_lock_option, "", p);
      }
    ;

unlock:
      UNLOCK_SYM table_or_tables
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNLOCK_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_unlock, "", p);
      }
    ;

handler:
      HANDLER_SYM table_ident OPEN_SYM opt_table_alias
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HANDLER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_OPEN_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_handler, "", p);
      }
    | HANDLER_SYM table_ident_nodb CLOSE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HANDLER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_CLOSE_SYM));
        $$= mysql_parser::new_tree_item(sql::_handler, "", p);
      }
    | HANDLER_SYM table_ident_nodb READ_SYM handler_read_or_scan where_clause opt_limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_HANDLER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_READ_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_handler, "", p);
      }
    ;

handler_read_or_scan:
      handler_scan_function
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_handler_read_or_scan, "", p);
      }
    | ident handler_rkey_function
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_handler_read_or_scan, "", p);
      }
    ;

handler_scan_function:
      FIRST_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_scan_function);
      }
    | NEXT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_scan_function);
      }
    ;

handler_rkey_function:
      FIRST_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FIRST_SYM));
        $$= mysql_parser::new_tree_item(sql::_handler_rkey_function, "", p);
      }
    | NEXT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NEXT_SYM));
        $$= mysql_parser::new_tree_item(sql::_handler_rkey_function, "", p);
      }
    | PREV_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PREV_SYM));
        $$= mysql_parser::new_tree_item(sql::_handler_rkey_function, "", p);
      }
    | LAST_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LAST_SYM));
        $$= mysql_parser::new_tree_item(sql::_handler_rkey_function, "", p);
      }
    | handler_rkey_mode '(' values ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_40));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_handler_rkey_function, "", p);
      }
    ;

handler_rkey_mode:
      EQ
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_rkey_mode);
      }
    | GE
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_rkey_mode);
      }
    | LE
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_rkey_mode);
      }
    | GT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_rkey_mode);
      }
    | LT
      {
        $$= mysql_parser::set_item_name($1, sql::_handler_rkey_mode);
      }
    ;

revoke:
      REVOKE clear_privileges revoke_command
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REVOKE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_revoke, "", p);
      }
    ;

revoke_command:
      grant_privileges ON opt_table grant_ident FROM grant_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_revoke_command, "", p);
      }
    | grant_privileges ON FUNCTION_SYM grant_ident FROM grant_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_revoke_command, "", p);
      }
    | grant_privileges ON PROCEDURE grant_ident FROM grant_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_revoke_command, "", p);
      }
    | ALL opt_privileges ',' GRANT OPTION FROM grant_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALL));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_44));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_GRANT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_OPTION));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_FROM));
        mysql_parser::tree_item_list_add(p, $7);
        $$= mysql_parser::new_tree_item(sql::_revoke_command, "", p);
      }
    ;

grant:
      GRANT clear_privileges grant_command
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GRANT));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_grant, "", p);
      }
    ;

grant_command:
      grant_privileges ON opt_table grant_ident TO_SYM grant_list require_clause grant_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_grant_command, "", p);
      }
    | grant_privileges ON FUNCTION_SYM grant_ident TO_SYM grant_list require_clause grant_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_grant_command, "", p);
      }
    | grant_privileges ON PROCEDURE grant_ident TO_SYM grant_list require_clause grant_options
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ON));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_grant_command, "", p);
      }
    ;

opt_table:
      /* empty */
      {
        $$= NULL;
      }
    | TABLE_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_table);
      }
    ;

grant_privileges:
      object_privilege_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_grant_privileges, "", p);
      }
    | ALL opt_privileges
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALL));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_grant_privileges, "", p);
      }
    ;

opt_privileges:
      /* empty */
      {
        $$= NULL;
      }
    | PRIVILEGES
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_privileges);
      }
    ;

object_privilege_list:
      object_privilege
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_object_privilege_list, "", p);
      }
    | object_privilege_list ',' object_privilege
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_object_privilege_list, p);
      }
    ;

object_privilege:
      SELECT_SYM opt_column_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SELECT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | INSERT opt_column_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INSERT));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | UPDATE_SYM opt_column_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UPDATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | REFERENCES opt_column_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REFERENCES));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | DELETE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DELETE_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | USAGE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_USAGE));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | INDEX_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INDEX_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | ALTER
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | CREATE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | DROP
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DROP));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | EXECUTE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EXECUTE_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | RELOAD
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RELOAD));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | SHUTDOWN
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SHUTDOWN));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | PROCESS
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PROCESS));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | FILE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FILE_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | GRANT OPTION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GRANT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_OPTION));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | SHOW DATABASES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SHOW));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_DATABASES));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | SUPER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUPER_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | CREATE TEMPORARY TABLES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TEMPORARY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TABLES));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | LOCK_SYM TABLES
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_LOCK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TABLES));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | REPLICATION SLAVE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPLICATION));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SLAVE));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | REPLICATION CLIENT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REPLICATION));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CLIENT_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | CREATE VIEW_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VIEW_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | SHOW VIEW_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SHOW));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VIEW_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | CREATE ROUTINE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ROUTINE_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | ALTER ROUTINE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALTER));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ROUTINE_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | CREATE USER
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CREATE));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_USER));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | EVENT_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_EVENT_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    | TRIGGER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIGGER_SYM));
        $$= mysql_parser::new_tree_item(sql::_object_privilege, "", p);
      }
    ;

opt_and:
      /* empty */
      {
        $$= NULL;
      }
    | AND_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_and);
      }
    ;

require_list:
      require_list_element opt_and require_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add_all(p, $3);
        mysql_parser::delete_tree_item($3);
        $$= mysql_parser::new_tree_item(sql::_require_list, "", p);
      }
    | require_list_element
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_require_list, "", p);
      }
    ;

require_list_element:
      SUBJECT_SYM TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUBJECT_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_require_list_element, "", p);
      }
    | ISSUER_SYM TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ISSUER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_require_list_element, "", p);
      }
    | CIPHER_SYM TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_CIPHER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_require_list_element, "", p);
      }
    ;

grant_ident:
      '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_grant_ident, "", p);
      }
    | ident '.' '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_grant_ident, "", p);
      }
    | '*' '.' '*'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_42));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_46));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_42));
        $$= mysql_parser::new_tree_item(sql::_grant_ident, "", p);
      }
    | table_ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_grant_ident, "", p);
      }
    ;

user_list:
      user
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_user_list, "", p);
      }
    | user_list ',' user
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_user_list, p);
      }
    ;

grant_list:
      grant_user
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_grant_list, "", p);
      }
    | grant_list ',' grant_user
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_grant_list, p);
      }
    ;

grant_user:
      user IDENTIFIED_SYM BY TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IDENTIFIED_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_grant_user, "", p);
      }
    | user IDENTIFIED_SYM BY PASSWORD TEXT_STRING
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_IDENTIFIED_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_BY));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_PASSWORD));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_TEXT_STRING));
        $$= mysql_parser::new_tree_item(sql::_grant_user, "", p);
      }
    | user
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_grant_user, "", p);
      }
    ;

opt_column_list:
      /* empty */
      {
        $$= NULL;
      }
    | '(' column_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_opt_column_list, "", p);
      }
    ;

column_list:
      column_list ',' column_list_id
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_column_list, p);
      }
    | column_list_id
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_column_list, "", p);
      }
    ;

column_list_id:
      ident
      {
        $$= mysql_parser::set_item_name($1, sql::_column_list_id);
      }
    ;

require_clause:
      /* empty */
      {
        $$= NULL;
      }
    | REQUIRE_SYM require_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REQUIRE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_require_clause, "", p);
      }
    | REQUIRE_SYM SSL_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REQUIRE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SSL_SYM));
        $$= mysql_parser::new_tree_item(sql::_require_clause, "", p);
      }
    | REQUIRE_SYM X509_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REQUIRE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_X509_SYM));
        $$= mysql_parser::new_tree_item(sql::_require_clause, "", p);
      }
    | REQUIRE_SYM NONE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_REQUIRE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NONE_SYM));
        $$= mysql_parser::new_tree_item(sql::_require_clause, "", p);
      }
    ;

grant_options:
      /* empty */
      {
        $$= NULL;
      }
    | WITH grant_option_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_grant_options, "", p);
      }
    ;

grant_option_list:
      grant_option_list grant_option
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::tree_item_reuse($1, sql::_grant_option_list, p);
      }
    | grant_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_grant_option_list, "", p);
      }
    ;

grant_option:
      GRANT OPTION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_GRANT));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_OPTION));
        $$= mysql_parser::new_tree_item(sql::_grant_option, "", p);
      }
    | MAX_QUERIES_PER_HOUR ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_QUERIES_PER_HOUR));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_grant_option, "", p);
      }
    | MAX_UPDATES_PER_HOUR ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_UPDATES_PER_HOUR));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_grant_option, "", p);
      }
    | MAX_CONNECTIONS_PER_HOUR ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_CONNECTIONS_PER_HOUR));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_grant_option, "", p);
      }
    | MAX_USER_CONNECTIONS_SYM ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_MAX_USER_CONNECTIONS_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_grant_option, "", p);
      }
    ;

begin:
      BEGIN_SYM opt_work
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_BEGIN_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_begin, "", p);
      }
    ;

opt_work:
      /* empty */
      {
        $$= NULL;
      }
    | WORK_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_work);
      }
    ;

opt_chain:
      /* empty */
      {
        $$= NULL;
      }
    | AND_SYM NO_SYM CHAIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AND_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_NO_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_CHAIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_chain, "", p);
      }
    | AND_SYM CHAIN_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AND_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CHAIN_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_chain, "", p);
      }
    ;

opt_release:
      /* empty */
      {
        $$= NULL;
      }
    | RELEASE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RELEASE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_release, "", p);
      }
    | NO_SYM RELEASE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_NO_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_RELEASE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_release, "", p);
      }
    ;

opt_savepoint:
      /* empty */
      {
        $$= NULL;
      }
    | SAVEPOINT_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_savepoint);
      }
    ;

commit:
      COMMIT_SYM opt_work opt_chain opt_release
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_COMMIT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_commit, "", p);
      }
    ;

rollback:
      ROLLBACK_SYM opt_work opt_chain opt_release
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ROLLBACK_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_rollback, "", p);
      }
    | ROLLBACK_SYM opt_work TO_SYM opt_savepoint ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ROLLBACK_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TO_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_rollback, "", p);
      }
    ;

savepoint:
      SAVEPOINT_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SAVEPOINT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_savepoint, "", p);
      }
    ;

release:
      RELEASE_SYM SAVEPOINT_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_RELEASE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SAVEPOINT_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_release, "", p);
      }
    ;

union_clause:
      /* empty */
      {
        $$= NULL;
      }
    | union_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_union_clause, "", p);
      }
    ;

union_list:
      UNION_SYM union_option select_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNION_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_union_list, "", p);
      }
    ;

union_opt:
      /* empty */
      {
        $$= NULL;
      }
    | union_list
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_union_opt, "", p);
      }
    | union_order_or_limit
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_union_opt, "", p);
      }
    ;

union_order_or_limit:
      order_or_limit
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_union_order_or_limit, "", p);
      }
    ;

order_or_limit:
      order_clause opt_limit_clause_init
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_order_or_limit, "", p);
      }
    | limit_clause
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_order_or_limit, "", p);
      }
    ;

union_option:
      /* empty */
      {
        $$= NULL;
      }
    | DISTINCT
      {
        $$= mysql_parser::set_item_name($1, sql::_union_option);
      }
    | ALL
      {
        $$= mysql_parser::set_item_name($1, sql::_union_option);
      }
    ;

take_first_select:
      /* empty */
      {
        $$= NULL;
      }
    ;

subselect:
      SELECT_SYM subselect_start select_init2 take_first_select subselect_end
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SELECT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_subselect, "", p);
      }
    | '(' subselect_start select_paren take_first_select subselect_end ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_subselect, "", p);
      }
    ;

subselect_start:
      /* empty */
      {
        $$= NULL;
      }
    ;

subselect_end:
      /* empty */
      {
        $$= NULL;
      }
    ;

view_or_trigger_or_sp_or_event:
      definer definer_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_view_or_trigger_or_sp_or_event, "", p);
      }
    | no_definer no_definer_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_view_or_trigger_or_sp_or_event, "", p);
      }
    | view_replace_or_algorithm definer_opt view_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_view_or_trigger_or_sp_or_event, "", p);
      }
    ;

definer_tail:
      view_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_tail, "", p);
      }
    | trigger_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_tail, "", p);
      }
    | sp_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_tail, "", p);
      }
    | sf_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_tail, "", p);
      }
    | event_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_tail, "", p);
      }
    ;

no_definer_tail:
      view_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_no_definer_tail, "", p);
      }
    | trigger_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_no_definer_tail, "", p);
      }
    | sp_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_no_definer_tail, "", p);
      }
    | sf_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_no_definer_tail, "", p);
      }
    | udf_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_no_definer_tail, "", p);
      }
    | event_tail
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_no_definer_tail, "", p);
      }
    ;

definer_opt:
      no_definer
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_opt, "", p);
      }
    | definer
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_definer_opt, "", p);
      }
    ;

no_definer:
      /* empty */
      {
        $$= NULL;
      }
    ;

definer:
      DEFINER_SYM EQ user
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_DEFINER_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_definer, "", p);
      }
    ;

view_replace_or_algorithm:
      view_replace
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_view_replace_or_algorithm, "", p);
      }
    | view_replace view_algorithm
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_view_replace_or_algorithm, "", p);
      }
    | view_algorithm
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_view_replace_or_algorithm, "", p);
      }
    ;

view_replace:
      OR_SYM REPLACE
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_OR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_REPLACE));
        $$= mysql_parser::new_tree_item(sql::_view_replace, "", p);
      }
    ;

view_algorithm:
      ALGORITHM_SYM EQ UNDEFINED_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALGORITHM_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_UNDEFINED_SYM));
        $$= mysql_parser::new_tree_item(sql::_view_algorithm, "", p);
      }
    | ALGORITHM_SYM EQ MERGE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALGORITHM_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_MERGE_SYM));
        $$= mysql_parser::new_tree_item(sql::_view_algorithm, "", p);
      }
    | ALGORITHM_SYM EQ TEMPTABLE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ALGORITHM_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_EQ));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_TEMPTABLE_SYM));
        $$= mysql_parser::new_tree_item(sql::_view_algorithm, "", p);
      }
    ;

view_suid:
      /* empty */
      {
        $$= NULL;
      }
    | SQL_SYM SECURITY_SYM DEFINER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SECURITY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_DEFINER_SYM));
        $$= mysql_parser::new_tree_item(sql::_view_suid, "", p);
      }
    | SQL_SYM SECURITY_SYM INVOKER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SQL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_SECURITY_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_INVOKER_SYM));
        $$= mysql_parser::new_tree_item(sql::_view_suid, "", p);
      }
    ;

view_tail:
      view_suid VIEW_SYM table_ident view_list_opt AS view_select
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_VIEW_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_AS));
        mysql_parser::tree_item_list_add(p, $6);
        $$= mysql_parser::new_tree_item(sql::_view_tail, "", p);
      }
    ;

view_list_opt:
      /* empty */
      {
        $$= NULL;
      }
    | '(' view_list ')'
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        $$= mysql_parser::new_tree_item(sql::_view_list_opt, "", p);
      }
    ;

view_list:
      ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_view_list, "", p);
      }
    | view_list ',' ident
      {
        void *p= mysql_parser::tree_item_list_reuse($1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::tree_item_reuse($1, sql::_view_list, p);
      }
    ;

view_select:
      view_select_aux view_check_option
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_view_select, "", p);
      }
    ;

view_select_aux:
      SELECT_SYM select_init2
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SELECT_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_view_select_aux, "", p);
      }
    | '(' select_paren ')' union_opt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_40));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_41));
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_view_select_aux, "", p);
      }
    ;

view_check_option:
      /* empty */
      {
        $$= NULL;
      }
    | WITH CHECK_SYM OPTION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CHECK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_OPTION));
        $$= mysql_parser::new_tree_item(sql::_view_check_option, "", p);
      }
    | WITH CASCADED CHECK_SYM OPTION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_CASCADED));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_CHECK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_OPTION));
        $$= mysql_parser::new_tree_item(sql::_view_check_option, "", p);
      }
    | WITH LOCAL_SYM CHECK_SYM OPTION
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_WITH));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_LOCAL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_CHECK_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_OPTION));
        $$= mysql_parser::new_tree_item(sql::_view_check_option, "", p);
      }
    ;

trigger_tail:
      TRIGGER_SYM remember_name sp_name trg_action_time trg_event ON remember_name table_ident FOR_SYM remember_name EACH_SYM ROW_SYM sp_proc_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_TRIGGER_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_ON));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($9, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, $10);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($11, sql::_EACH_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($12, sql::_ROW_SYM));
        mysql_parser::tree_item_list_add(p, $13);
        $$= mysql_parser::new_tree_item(sql::_trigger_tail, "", p);
      }
    ;

udf_tail:
      AGGREGATE_SYM remember_name FUNCTION_SYM ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_AGGREGATE_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($3, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $4);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($5, sql::_RETURNS_SYM));
        mysql_parser::tree_item_list_add(p, $6);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_SONAME_SYM));
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_udf_tail, "", p);
      }
    | remember_name FUNCTION_SYM ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_RETURNS_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_SONAME_SYM));
        mysql_parser::tree_item_list_add(p, $7);
        $$= mysql_parser::new_tree_item(sql::_udf_tail, "", p);
      }
    ;

sf_tail:
      remember_name FUNCTION_SYM sp_name '(' sp_fdparam_list ')' RETURNS_SYM type sp_c_chistics sp_proc_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_FUNCTION_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($7, sql::_RETURNS_SYM));
        mysql_parser::tree_item_list_add(p, $8);
        mysql_parser::tree_item_list_add(p, $9);
        mysql_parser::tree_item_list_add(p, $10);
        $$= mysql_parser::new_tree_item(sql::_sf_tail, "", p);
      }
    ;

sp_tail:
      PROCEDURE remember_name sp_name '(' sp_pdparam_list ')' sp_c_chistics sp_proc_stmt
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_PROCEDURE));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_40));
        mysql_parser::tree_item_list_add(p, $5);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($6, sql::_41));
        mysql_parser::tree_item_list_add(p, $7);
        mysql_parser::tree_item_list_add(p, $8);
        $$= mysql_parser::new_tree_item(sql::_sp_tail, "", p);
      }
    ;

xa:
      XA_SYM begin_or_start xid opt_join_or_resume
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_XA_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_xa, "", p);
      }
    | XA_SYM END xid opt_suspend
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_XA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_END));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_xa, "", p);
      }
    | XA_SYM PREPARE_SYM xid
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_XA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PREPARE_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_xa, "", p);
      }
    | XA_SYM COMMIT_SYM xid opt_one_phase
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_XA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_COMMIT_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, $4);
        $$= mysql_parser::new_tree_item(sql::_xa, "", p);
      }
    | XA_SYM ROLLBACK_SYM xid
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_XA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_ROLLBACK_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_xa, "", p);
      }
    | XA_SYM RECOVER_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_XA_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_RECOVER_SYM));
        $$= mysql_parser::new_tree_item(sql::_xa, "", p);
      }
    ;

xid:
      text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        $$= mysql_parser::new_tree_item(sql::_xid, "", p);
      }
    | text_string ',' text_string
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_xid, "", p);
      }
    | text_string ',' text_string ',' ulong_num
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, $1);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_44));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_44));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_xid, "", p);
      }
    ;

begin_or_start:
      BEGIN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_begin_or_start);
      }
    | START_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_begin_or_start);
      }
    ;

opt_join_or_resume:
      /* empty */
      {
        $$= NULL;
      }
    | JOIN_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_join_or_resume);
      }
    | RESUME_SYM
      {
        $$= mysql_parser::set_item_name($1, sql::_opt_join_or_resume);
      }
    ;

opt_one_phase:
      /* empty */
      {
        $$= NULL;
      }
    | ONE_SYM PHASE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_ONE_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PHASE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_one_phase, "", p);
      }
    ;

opt_suspend:
      /* empty */
      {
        $$= NULL;
      }
    | SUSPEND_SYM opt_migrate
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_SUSPEND_SYM));
        mysql_parser::tree_item_list_add(p, $2);
        $$= mysql_parser::new_tree_item(sql::_opt_suspend, "", p);
      }
    ;

opt_migrate:
      /* empty */
      {
        $$= NULL;
      }
    | FOR_SYM MIGRATE_SYM
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_FOR_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_MIGRATE_SYM));
        $$= mysql_parser::new_tree_item(sql::_opt_migrate, "", p);
      }
    ;

install:
      INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_INSTALL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PLUGIN_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($4, sql::_SONAME_SYM));
        mysql_parser::tree_item_list_add(p, $5);
        $$= mysql_parser::new_tree_item(sql::_install, "", p);
      }
    ;

uninstall:
      UNINSTALL_SYM PLUGIN_SYM ident
      {
        void *p= mysql_parser::new_tree_item_list();
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($1, sql::_UNINSTALL_SYM));
        mysql_parser::tree_item_list_add(p, mysql_parser::set_item_name($2, sql::_PLUGIN_SYM));
        mysql_parser::tree_item_list_add(p, $3);
        $$= mysql_parser::new_tree_item(sql::_uninstall, "", p);
      }
    ;

