| 16 | namespace parser { |
| 17 | |
| 18 | std::vector<std::shared_ptr<Statement>> Transformer::transform() { |
| 19 | std::vector<std::shared_ptr<Statement>> statements; |
| 20 | for (auto& oc_Statement : root.oC_Cypher()) { |
| 21 | auto statement = transformStatement(*oc_Statement->oC_Statement()); |
| 22 | if (oc_Statement->oC_AnyCypherOption()) { |
| 23 | auto cypherOption = oc_Statement->oC_AnyCypherOption(); |
| 24 | auto explainType = ExplainType::PROFILE; |
| 25 | if (cypherOption->oC_Explain()) { |
| 26 | explainType = cypherOption->oC_Explain()->LOGICAL() ? ExplainType::LOGICAL_PLAN : |
| 27 | ExplainType::PHYSICAL_PLAN; |
| 28 | } |
| 29 | statements.push_back( |
| 30 | std::make_unique<ExplainStatement>(std::move(statement), explainType)); |
| 31 | continue; |
| 32 | } |
| 33 | statements.push_back(std::move(statement)); |
| 34 | } |
| 35 | return statements; |
| 36 | } |
| 37 | |
| 38 | std::unique_ptr<Statement> Transformer::transformStatement(CypherParser::OC_StatementContext& ctx) { |
| 39 | if (ctx.oC_Query()) { |
no test coverage detected