(pos Pos)
| 1239 | } |
| 1240 | |
| 1241 | func (p *Parser) parseExplainStmt(pos Pos) (*ExplainStmt, error) { |
| 1242 | if err := p.expectKeyword(KeywordExplain); err != nil { |
| 1243 | return nil, err |
| 1244 | } |
| 1245 | |
| 1246 | var explainType string |
| 1247 | switch { |
| 1248 | case p.matchKeyword(KeywordSyntax), |
| 1249 | p.matchKeyword(KeywordPipeline), |
| 1250 | p.matchKeyword(KeywordEstimate), |
| 1251 | p.matchKeyword(KeywordAst): |
| 1252 | explainType = p.last().String |
| 1253 | _ = p.lexer.consumeToken() |
| 1254 | default: |
| 1255 | return nil, fmt.Errorf("expected SYNTAX, PIPELINE, ESTIMATE or AST, got %s", p.lastTokenKind()) |
| 1256 | } |
| 1257 | stmt, err := p.parseSelectQuery(p.Pos()) |
| 1258 | if err != nil { |
| 1259 | return nil, err |
| 1260 | } |
| 1261 | return &ExplainStmt{ |
| 1262 | ExplainPos: pos, |
| 1263 | Type: explainType, |
| 1264 | Statement: stmt, |
| 1265 | }, nil |
| 1266 | } |
no test coverage detected