MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / UnnestContext

Method UnnestContext

parser/parser.cc:822–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

820}
821
822antlr4::tree::ParseTree* ParserVisitor::UnnestContext(
823 antlr4::tree::ParseTree* tree) {
824 antlr4::tree::ParseTree* last = nullptr;
825 while (tree != last) {
826 last = tree;
827
828 if (auto* ctx = tree_as<CelParser::StartContext>(tree)) {
829 tree = ctx->expr();
830 }
831
832 if (auto* ctx = tree_as<CelParser::ExprContext>(tree)) {
833 if (ctx->op != nullptr) {
834 return ctx;
835 }
836 tree = ctx->e;
837 }
838
839 if (auto* ctx = tree_as<CelParser::ConditionalOrContext>(tree)) {
840 if (!ctx->ops.empty()) {
841 return ctx;
842 }
843 tree = ctx->e;
844 }
845
846 if (auto* ctx = tree_as<CelParser::ConditionalAndContext>(tree)) {
847 if (!ctx->ops.empty()) {
848 return ctx;
849 }
850 tree = ctx->e;
851 }
852
853 if (auto* ctx = tree_as<CelParser::RelationContext>(tree)) {
854 if (ctx->calc() == nullptr) {
855 return ctx;
856 }
857 tree = ctx->calc();
858 }
859
860 if (auto* ctx = tree_as<CelParser::CalcContext>(tree)) {
861 if (ctx->unary() == nullptr) {
862 return ctx;
863 }
864 tree = ctx->unary();
865 }
866
867 if (auto* ctx = tree_as<CelParser::MemberExprContext>(tree)) {
868 tree = ctx->member();
869 }
870
871 if (auto* ctx = tree_as<CelParser::PrimaryExprContext>(tree)) {
872 if (auto* nested = tree_as<CelParser::NestedContext>(ctx->primary())) {
873 tree = nested->e;
874 } else {
875 return ctx;
876 }
877 }
878 }
879

Callers

nothing calls this directly

Calls 3

memberMethod · 0.80
exprMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected