(pos Pos)
| 408 | } |
| 409 | |
| 410 | func (p *Parser) parseAlterTableDropClause(pos Pos) (AlterTableClause, error) { |
| 411 | var kind string |
| 412 | switch { |
| 413 | case p.matchKeyword(KeywordColumn): |
| 414 | kind = KeywordColumn |
| 415 | case p.matchKeyword(KeywordIndex): |
| 416 | kind = KeywordIndex |
| 417 | case p.matchKeyword(KeywordProjection): |
| 418 | kind = KeywordProjection |
| 419 | default: |
| 420 | return nil, fmt.Errorf("expected token: COLUMN|INDEX|PROJECTION, but got %s", p.lastTokenKind()) |
| 421 | } |
| 422 | _ = p.lexer.consumeToken() |
| 423 | |
| 424 | ifExists, err := p.tryParseIfExists() |
| 425 | if err != nil { |
| 426 | return nil, err |
| 427 | } |
| 428 | |
| 429 | name, err := p.ParseNestedIdentifier(p.Pos()) |
| 430 | if err != nil { |
| 431 | return nil, err |
| 432 | } |
| 433 | |
| 434 | if kind == KeywordProjection { |
| 435 | return &AlterTableDropProjection{ |
| 436 | DropPos: pos, |
| 437 | ProjectionName: name, |
| 438 | IfExists: ifExists, |
| 439 | }, nil |
| 440 | } else if kind == KeywordColumn { |
| 441 | return &AlterTableDropColumn{ |
| 442 | DropPos: pos, |
| 443 | ColumnName: name, |
| 444 | IfExists: ifExists, |
| 445 | }, nil |
| 446 | } else { |
| 447 | return &AlterTableDropIndex{ |
| 448 | DropPos: pos, |
| 449 | IndexName: name, |
| 450 | IfExists: ifExists, |
| 451 | }, nil |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | func (p *Parser) tryParseAfterClause() (*NestedIdentifier, error) { |
| 456 | if !p.tryConsumeKeywords(KeywordAfter) { |
no test coverage detected