parseConstraintColumnList parses a parenthesized list of column names
()
| 461 | |
| 462 | // parseConstraintColumnList parses a parenthesized list of column names |
| 463 | func (p *Parser) parseConstraintColumnList() ([]string, error) { |
| 464 | if !p.isType(models.TokenTypeLParen) { |
| 465 | return nil, p.expectedError("( for column list") |
| 466 | } |
| 467 | p.advance() // Consume ( |
| 468 | |
| 469 | var columns []string |
| 470 | for { |
| 471 | if !p.isIdentifier() { |
| 472 | return nil, p.expectedError("column name") |
| 473 | } |
| 474 | columns = append(columns, p.currentToken.Token.Value) |
| 475 | p.advance() |
| 476 | |
| 477 | if p.isType(models.TokenTypeComma) { |
| 478 | p.advance() |
| 479 | continue |
| 480 | } |
| 481 | break |
| 482 | } |
| 483 | |
| 484 | if !p.isType(models.TokenTypeRParen) { |
| 485 | return nil, p.expectedError(") after column list") |
| 486 | } |
| 487 | p.advance() // Consume ) |
| 488 | |
| 489 | return columns, nil |
| 490 | } |
| 491 | |
| 492 | // parseTypeArgsString consumes a balanced parenthesised type-argument list |
| 493 | // and returns it as a string (including the outer parens). Supports nested |
no test coverage detected