MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / transform

Method transform

src/parser/transformer.cpp:18–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace parser {
17
18std::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
38std::unique_ptr<Statement> Transformer::transformStatement(CypherParser::OC_StatementContext& ctx) {
39 if (ctx.oC_Query()) {

Callers 2

parseQueryMethod · 0.80

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected