(pos Pos)
| 15 | } |
| 16 | |
| 17 | func (p *Parser) parseWithClause(pos Pos) (*WithClause, error) { |
| 18 | if err := p.expectKeyword(KeywordWith); err != nil { |
| 19 | return nil, err |
| 20 | } |
| 21 | |
| 22 | cteExpr, err := p.parseCTEStmt(p.Pos()) |
| 23 | if err != nil { |
| 24 | return nil, err |
| 25 | } |
| 26 | ctes := []*CTEStmt{cteExpr} |
| 27 | for p.tryConsumeTokenKind(TokenKindComma) != nil { |
| 28 | cteExpr, err := p.parseCTEStmt(p.Pos()) |
| 29 | if err != nil { |
| 30 | return nil, err |
| 31 | } |
| 32 | ctes = append(ctes, cteExpr) |
| 33 | } |
| 34 | |
| 35 | return &WithClause{ |
| 36 | WithPos: pos, |
| 37 | CTEs: ctes, |
| 38 | EndPos: ctes[len(ctes)-1].End(), |
| 39 | }, nil |
| 40 | } |
| 41 | |
| 42 | func (p *Parser) tryParseTopClause(pos Pos) (*TopClause, error) { |
| 43 | if !p.matchKeyword(KeywordTop) { |
no test coverage detected