comment(# All of the values below are valid MySQL syntax accoring to) comment(# the Reference Manual:) comment(# http://dev.mysql.com/doc/refman/5.1/en/language-structure.html) comment(# unless stated otherwise.) comment(# strings) class(SELECT) stringoperator(;) class(SELECT) stringoperator(;) class(SELECT) stringoperator(;) class(SELECT) string reserved(COLLATE) ident(latin1_danish_ci)operator(;) class(SELECT) stringoperator(;) class(SELECT) stringoperator(;) class(SELECT) stringoperator(;) class(SELECT) stringoperator(;) comment(# ") class(SELECT) stringoperator(;) comment(# ') class(SELECT) stringoperator(;) comment(# ") class(SELECT) stringoperator(;) comment(# ') class(SELECT) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(;) comment(-- ') class(SELECT) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(;) comment(-- ") class(SELECT) stringoperator(;) class(SELECT) stringoperator(;) comment(# numbers) class(select) integer(1221)operator(;) class(select) integer(0)operator(;) class(select) operator(-)integer(32)error(:) class(select) float(294.42)error(:) class(select) operator(-)float(32032.6809e+10)operator(;) class(select) float(148.00)operator(;) class(select) float(10e+10)operator(;) class(select) float(10e10)operator(;) comment(# hexadecimal) class(SELECT) stringoperator(;) class(SELECT) hex(0x0a)operator(+)integer(0)operator(;) class(SELECT) hex(0x5061756c)operator(;) class(SELECT) hex(0x41)operator(,) predefined(CAST)operator(()hex(0x41) reserved(AS) pre_type(UNSIGNED)operator(\))operator(;) class(SELECT) pre_type(HEX)operator(()stringoperator(\))operator(;) class(SELECT) hex(0x636174)operator(;) class(insert) class(into) ident(t) operator(()ident(md5)operator(\)) reserved(values) operator(()hex(0xad65)operator(\))operator(;) class(SELECT) operator(*) reserved(FROM) ident(SomeTable) reserved(WHERE) ident(BinaryColumn) operator(=) predefined(CAST)operator(() string reserved(AS) pre_type(BINARY) operator(\))operator(;) class(select) stringoperator(,) stringoperator(;) class(SELECT) pre_constant(TRUE)operator(,) pre_constant(true)operator(,) pre_constant(FALSE)operator(,) pre_constant(false)operator(;) class(SELECT) pre_constant(NULL)operator(,) pre_constant(null)operator(,) pre_constant(nuLL)operator(,) pre_constant(\\N)operator(;) class(SELECT) error(\\)ident(n)operator(;) comment(# invalid!) comment(# bit-field) class(CREATE) type(TABLE) ident(t) operator(()ident(b) pre_type(BIT)operator(()integer(8)operator(\))operator(\))operator(;) class(INSERT) class(INTO) ident(t) class(SET) ident(b) operator(=) stringoperator(;) class(INSERT) class(INTO) ident(t) class(SET) ident(b) operator(=) stringoperator(;) class(INSERT) class(INTO) ident(t) class(SET) ident(b) operator(=) stringoperator(;) class(SELECT) ident(b)operator(+)integer(0)operator(,) pre_type(BIN)operator(()ident(b)operator(+)integer(0)operator(\))operator(,) pre_type(OCT)operator(()ident(b)operator(+)integer(0)operator(\))operator(,) pre_type(HEX)operator(()ident(b)operator(+)integer(0)operator(\)) reserved(FROM) ident(t)operator(;) class(SET) variable(@v1) operator(=) stringoperator(;) class(SET) variable(@v2) operator(=) predefined(CAST)operator(()string reserved(AS) pre_type(UNSIGNED)operator(\))operator(,) variable(@v3) operator(=) stringoperator(+)integer(0)operator(;) class(SELECT) variable(@v1)operator(,) variable(@v2)operator(,) variable(@v3)operator(;) class(INSERT) class(INTO) ident(my_table) operator(()ident(phone)operator(\)) reserved(VALUES) operator(()pre_constant(NULL)operator(\))operator(;) class(INSERT) class(INTO) ident(my_table) operator(()ident(phone)operator(\)) reserved(VALUES) operator(()stringoperator(\))operator(;) comment(# schema object names) class(SELECT) operator(*) reserved(FROM) string reserved(WHERE) stringoperator(.)ident(id) operator(>) integer(100)operator(;) class(CREATE) type(TABLE) string operator(()string pre_type(INT)operator(\))operator(;) class(SELECT) integer(1) reserved(AS) stringoperator(,) integer(2) reserved(AS) stringoperator(;) class(select) ident(foo) reserved(from) ident(foo)operator(;) class(select) string reserved(from) ident(foo)operator(;) class(select) ident(foo)operator(.)ident(bar) reserved(from) ident(foo)operator(;) class(select) stringoperator(.)ident(bar) reserved(from) ident(foo)operator(;) class(select) ident(foo)operator(.)string reserved(from) ident(foo)operator(;) class(select) string reserved(from) ident(foo)operator(;) class(select) stringoperator(.)string reserved(from) ident(foo)operator(;) comment(# How to handle ANSI_QUOTES?) class(CREATE) type(TABLE) string operator(()ident(col) pre_type(INT)operator(\))operator(;) class(SET) ident(sql_mode)operator(=)stringoperator(;) class(CREATE) type(TABLE) string operator(()ident(col) pre_type(INT)operator(\))operator(;) comment(# identifiers) class(SELECT) operator(*) reserved(FROM) ident(my_table) reserved(WHERE) ident(MY_TABLE)operator(.)ident(col)operator(=)integer(1)operator(;) class(SHOW) type(COLUMNS) reserved(FROM) stringoperator(;) comment(# Function Name Parsing and Resolution) class(SELECT) predefined(COUNT)operator(()operator(*)operator(\)) reserved(FROM) ident(mytable)operator(;) comment(-- the first reference to count is a function call) class(CREATE) type(TABLE) predefined(count) operator(()ident(i) pre_type(INT)operator(\))operator(;) comment(-- whereas the second reference is a table name) class(CREATE) type(TABLE) stringoperator(()ident(i) pre_type(INT)operator(\))operator(;) comment(-- this too) class(CREATE) type(TABLE) string operator(()ident(i) pre_type(INT)operator(\))operator(;) comment(-- this too) comment(# IGNORE_SPACE) class(SELECT) predefined(COUNT)operator(()operator(*)operator(\)) reserved(FROM) ident(mytable)operator(;) class(SELECT) predefined(COUNT) operator(()operator(*)operator(\)) reserved(FROM) ident(mytable)operator(;) comment(# reserved words) class(CREATE) type(TABLE) ident(interval) operator(()reserved(begin) pre_type(INT)operator(,) reserved(end) pre_type(INT)operator(\))operator(;) comment(-- errror) class(CREATE) type(TABLE) string operator(()reserved(begin) pre_type(INT)operator(,) reserved(end) pre_type(INT)operator(\))operator(;) comment(-- valid) class(CREATE) type(TABLE) ident(mydb)operator(.)ident(interval) operator(()reserved(begin) pre_type(INT)operator(,) reserved(end) pre_type(INT)operator(\))operator(;) comment(-- valid) class(SELECT) stringoperator(,) string reserved(FROM) string reserved(WHERE) string operator(=) stringoperator(;) comment(-- valid)