-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathcomprehension_step.h
More file actions
65 lines (48 loc) · 1.76 KB
/
Copy pathcomprehension_step.h
File metadata and controls
65 lines (48 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef THIRD_PARTY_CEL_CPP_EVAL_EVAL_COMPREHENSION_STEP_H_
#define THIRD_PARTY_CEL_CPP_EVAL_EVAL_COMPREHENSION_STEP_H_
#include <cstdint>
#include <memory>
#include <string>
#include "eval/eval/evaluator_core.h"
#include "eval/eval/expression_step_base.h"
namespace google::api::expr::runtime {
class ComprehensionNextStep : public ExpressionStepBase {
public:
ComprehensionNextStep(const std::string& accu_var,
const std::string& iter_var, int64_t expr_id);
void set_jump_offset(int offset);
void set_error_jump_offset(int offset);
absl::Status Evaluate(ExecutionFrame* frame) const override;
private:
std::string accu_var_;
std::string iter_var_;
int jump_offset_;
int error_jump_offset_;
};
class ComprehensionCondStep : public ExpressionStepBase {
public:
ComprehensionCondStep(const std::string& accu_var,
const std::string& iter_var, bool shortcircuiting,
int64_t expr_id);
void set_jump_offset(int offset);
void set_error_jump_offset(int offset);
absl::Status Evaluate(ExecutionFrame* frame) const override;
private:
std::string iter_var_;
int jump_offset_;
int error_jump_offset_;
bool shortcircuiting_;
};
class ComprehensionFinish : public ExpressionStepBase {
public:
ComprehensionFinish(const std::string& accu_var, const std::string& iter_var,
int64_t expr_id);
absl::Status Evaluate(ExecutionFrame* frame) const override;
private:
std::string accu_var_;
};
// Creates a step that lists the map keys if the top of the stack is a map,
// otherwise it's a no-op.
std::unique_ptr<ExpressionStep> CreateListKeysStep(int64_t expr_id);
} // namespace google::api::expr::runtime
#endif // THIRD_PARTY_CEL_CPP_EVAL_EVAL_COMPREHENSION_STEP_H_