mirror of
https://github.com/allankoechke/cpp-expr-eval.git
synced 2026-12-01 09:13:36 +00:00
Added modulus, comparators and relational ops
This commit is contained in:
@@ -39,6 +39,20 @@ struct RuntimeVar {
|
||||
RuntimeVar operator*(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator/(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator%(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator==(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator!=(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator>(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator>=(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator<(const RuntimeVar& other) const;
|
||||
|
||||
RuntimeVar operator<=(const RuntimeVar& other) const;
|
||||
};
|
||||
|
||||
#endif // RUNTIME_H
|
||||
|
||||
@@ -16,6 +16,18 @@ enum class TokenType {
|
||||
TOK_SUB_OP,
|
||||
TOK_DIV_OP,
|
||||
TOK_MULT_OP,
|
||||
TOK_MOD_OP,
|
||||
|
||||
TOK_OR, // ||
|
||||
TOK_AND, // &&
|
||||
|
||||
TOK_EQ, // ==
|
||||
TOK_NEQ, // !=
|
||||
TOK_LT, // <
|
||||
TOK_LT_EQ, // <=
|
||||
TOK_GT, // >
|
||||
TOK_GT_EQ, // >=
|
||||
|
||||
|
||||
TOK_OPEN_PAREN, // (
|
||||
TOK_CLOSE_PAREN, // )
|
||||
|
||||
@@ -20,6 +20,14 @@ public:
|
||||
private:
|
||||
std::unique_ptr<Node> parseExpr();
|
||||
|
||||
std::unique_ptr<Node> parseOr(); // ||
|
||||
|
||||
std::unique_ptr<Node> parseAnd(); // &&
|
||||
|
||||
std::unique_ptr<Node> parseEquality(); // == !=
|
||||
|
||||
std::unique_ptr<Node> parseRelational(); // < > <= >=
|
||||
|
||||
std::unique_ptr<Node> parseAdditives();
|
||||
|
||||
std::unique_ptr<Node> parseFactors();
|
||||
|
||||
Reference in New Issue
Block a user