# README
Parser - A MySQL Compatible SQL Parser
The goal of this project is to build a Golang parser that is fully compatible with MySQL syntax, easy to extend, and high performance. Currently, features supported by parser are as follows:
- Highly compatible with MySQL: it supports almost all features of MySQL. For the complete details, see parser.y and hintparser.y.
- Extensible: adding a new syntax requires only a few lines of Yacc and Golang code changes. As an example, see PR-9.
- Good performance: the parser is generated by goyacc in a bottom-up approach. It is efficient to build an AST tree with a state machine.
Future
- Support more MySQL syntax
- Optimize the code structure, make it easier to extend
- Improve performance and benchmark
- Improve the quality of code and comments
License
Parser is under the Apache 2.0 license. See the LICENSE file for details.
# Packages
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
No description provided by the author
No description provided by the author
No description provided by the author
Goyacc is a version of yacc generating Go parsers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
DigestHash generates the digest of statements.
DigestNormalized generates the digest of a normalized sql.
New returns a Parser object with default SQL mode.
NewDigest returns a new digest.
NewScanner returns a new scanner object.
Normalize generates the normalized statements.
NormalizeDigest combines Normalize and DigestNormalized into one method.
ParseErrorWith returns "You have a syntax error near..." error message compatible with mysql.
ParseHint parses an optimizer hint (the interior of `/*+ ..
TrimComment trim comment for special comment code of MySQL.
# Variables
ErrInvalidYearColumnLength returns for illegal column length for year type.
ErrParse returns for sql parse error.
ErrSyntax returns for sql syntax error.
ErrTooBigDisplayWidth returns for data display width exceed limit .
ErrTooBigPrecision returns for data precision exceed limit.
ErrUnknownAlterAlgorithm returns for no alter algorithm found error.
ErrUnknownAlterLock returns for no alter lock type found error.
ErrUnknownCharacterSet returns for no character set found error.
ErrWarnDeprecatedIntegerDisplayWidth share the same code 1681, and it will be returned when length is specified in integer.
ErrWarnDeprecatedSyntaxNoReplacement return when the syntax was deprecated and there is no replacement.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ErrWrongArguments returns for illegal argument.
ErrWrongFieldTerminators returns for illegal field terminators.
ErrWrongUsage returns for incorrect usages.
ErrWrongValue returns for wrong value.
SpecFieldPattern special result field pattern.
# Structs
No description provided by the author
Parser represents a parser instance.
No description provided by the author
Pos represents the position of a token.
Scanner implements the yyLexer interface.
# Interfaces
ParseParam represents the parameter of parsing.
# Type aliases
CharsetClient specifies the charset of a SQL.
CharsetConnection is used for literals specified without a character set.
CollationConnection is used for literals specified without a collation.