MCPcopy Create free account
hub / github.com/LissaGreense/GO4SQL / parseDropCommand

Method parseDropCommand

parser/parser.go:415–439  ·  view source on GitHub ↗

parseDropCommand - Return ast.DropCommand created from tokens and validate the syntax Example of input parsable to the ast.DropCommand: DROP TABLE table;

()

Source from the content-addressed store, hash-verified

413// Example of input parsable to the ast.DropCommand:
414// DROP TABLE table;
415func (parser *Parser) parseDropCommand() (ast.Command, error) {
416 // token.DROP already at current position in parser
417 dropCommand := &ast.DropCommand{Token: parser.currentToken}
418
419 // token.DROP no longer needed
420 parser.nextToken()
421
422 err := validateTokenAndSkip(parser, []token.Type{token.TABLE})
423 if err != nil {
424 return nil, err
425 }
426
427 err = validateToken(parser.currentToken.Type, []token.Type{token.IDENT})
428 if err != nil {
429 return nil, err
430 }
431 dropCommand.Name = ast.Identifier{Token: parser.currentToken}
432
433 // token.IDENT no longer needed
434 parser.nextToken()
435
436 err = validateTokenAndSkip(parser, []token.Type{token.SEMICOLON})
437
438 return dropCommand, err
439}
440
441// parseOrderByCommand - Return ast.OrderByCommand created from tokens and validate the syntax
442//

Callers 1

ParseSequenceMethod · 0.95

Calls 3

nextTokenMethod · 0.95
validateTokenAndSkipFunction · 0.85
validateTokenFunction · 0.85

Tested by

no test coverage detected