Add support for UNION

This commit is contained in:
Asdine El Hrychy
2021-09-30 20:47:22 +04:00
parent 524e633049
commit 412d30030d
27 changed files with 1062 additions and 480 deletions

View File

@@ -90,6 +90,7 @@ func (p *Parser) ParseQuery() (query.Query, error) {
// ParseStatement parses a Genji SQL string and returns a Statement AST object.
func (p *Parser) ParseStatement() (statement.Statement, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
p.Unscan()
switch tok {
case scanner.ALTER:
return p.parseAlterStatement()
@@ -210,7 +211,7 @@ func (p *Parser) parseTokens(tokens ...scanner.Token) error {
}
// parseOptional parses a list of consecutive tokens. If the first token is not
// present, it unscans and return false. If the fist is present, all the others
// present, it unscans and return false. If the first is present, all the others
// must be parsed otherwise an error is returned.
func (p *Parser) parseOptional(tokens ...scanner.Token) (bool, error) {
// Parse optional first token