+Expr getExpr(TocParser::DotExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::Dot;\r
+ result._dot.expr = std::make_unique<Expr>(getExpr(ctx->expr()));\r
+ result._dot.identifier = ctx->varName()->getText();\r
+ result._dot.isPointer = ctx->arrow() != nullptr;\r
+ return result;\r
+}\r
+Expr getExpr(TocParser::PrefixOpExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::PrefixOp;\r
+ result._prefixOp.expr = std::make_unique<Expr>(getExpr(ctx->expr()));\r
+ result._prefixOp.type = getOperatorType<PrefixOperatorType>(\r
+ ctx->prefix_op()->getText(),\r
+ PrefixOperatorTypeStrings);\r
+ return result;\r
+}\r
+Expr getExpr(TocParser::PostfixOpExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::PostfixOp;\r
+ result._postfixOp.expr = std::make_unique<Expr>(getExpr(ctx->expr()));\r
+ result._postfixOp.type = getOperatorType<PostfixOperatorType>(\r
+ ctx->postfix_op()->getText(),\r
+ PostfixOperatorTypeStrings);\r
+ return result;\r
+}\r
+Expr getExpr(TocParser::BinaryOpExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::BinaryOp;\r
+ result._binaryOp.lexpr = std::make_unique<Expr>(getExpr(ctx->expr(0)));\r
+ result._binaryOp.rexpr = std::make_unique<Expr>(getExpr(ctx->expr(1)));\r
+ result._binaryOp.type = getOperatorType<BinaryOperatorType>(\r
+ ctx->binary_op()->getText(),\r
+ BinaryOperatorTypeStrings);\r
+ return result;\r
+}\r
+Expr getExpr(TocParser::TernaryOpExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::TernaryOp;\r
+ result._ternaryOp.lexpr = std::make_unique<Expr>(getExpr(ctx->expr(0)));\r
+ result._ternaryOp.rexprTrue = std::make_unique<Expr>(getExpr(ctx->expr(1)));\r
+ result._ternaryOp.rexprFalse = std::make_unique<Expr>(getExpr(ctx->expr(2)));\r
+ return result;\r
+}\r
+Expr getExpr(TocParser::BracketExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::Bracket;\r
+ result._brackets.lexpr = std::make_unique<Expr>(getExpr(ctx->expr(0)));\r
+ result._brackets.rexpr = std::make_unique<Expr>(getExpr(ctx->expr(1)));\r
+ return result;\r
+}\r
+Expr getExpr(TocParser::IdentifierExprContext * ctx)\r
+{\r
+ Expr result;\r
+ result.type = ExprType::Identifier;\r
+ for (auto n : ctx->namespaceSpecifier())\r
+ result._identifier.namespacePrefixes.push_back(n->typeName()->getText());\r
+ result._identifier.identifier = ctx->varName()->getText();\r
+ return result;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+Expr getExpr(TocParser::ExprContext * ctx)\r
+{\r
+ Expr result;\r
+ if (dynamic_cast<TocParser::FuncExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::FuncExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::MethodExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::MethodExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::LitExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::LitExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::ParenExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::ParenExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::DotExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::DotExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::PrefixOpExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::PrefixOpExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::PostfixOpExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::PostfixOpExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::BinaryOpExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::BinaryOpExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::TernaryOpExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::TernaryOpExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::BracketExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::BracketExprContext *>(ctx));\r
+ if (dynamic_cast<TocParser::IdentifierExprContext *>(ctx) != nullptr)\r
+ result = getExpr(dynamic_cast<TocParser::IdentifierExprContext *>(ctx));\r
+ return result;\r
+}\r
+Stmt getStmt(TocParser::StmtContext * ctx, std::shared_ptr<Context> parent)\r
+{\r