diff --git a/tinyexpr.cpp b/tinyexpr.cpp index 9b03208..5dcbe1d 100644 --- a/tinyexpr.cpp +++ b/tinyexpr.cpp @@ -1251,7 +1251,7 @@ te_expr* te_parser::expr_level2(te_parser::state* theState) { /* = {(logic operations) } */ // next to lowest in precedence... - te_expr* ret = expr_level7(theState); + te_expr* ret = expr_level6(theState); while (theState->m_type == te_parser::state::token_type::TOK_INFIX && is_function2(theState->m_value) && @@ -1259,19 +1259,20 @@ te_expr* te_parser::expr_level2(te_parser::state* theState) { const te_fun2 func = get_function2(theState->m_value); next_token(theState); - ret = new_expr(TE_PURE, func, { ret, expr_level7(theState) }); + ret = new_expr(TE_PURE, func, { ret, expr_level6(theState) }); } return ret; } -// levels 3-6 open for possible future extensions +// levels 3-5 open for possible future extensions +// of bitwise OR, XOR, and AND //-------------------------------------------------- -te_expr* te_parser::expr_level7(te_parser::state* theState) +te_expr* te_parser::expr_level6(te_parser::state* theState) { /* = {(logic operations) } */ // next to lowest in precedence... - te_expr* ret = expr_level8(theState); + te_expr* ret = expr_level7(theState); while (theState->m_type == te_parser::state::token_type::TOK_INFIX && is_function2(theState->m_value) && @@ -1280,17 +1281,17 @@ te_expr* te_parser::expr_level7(te_parser::state* theState) { const te_fun2 func = get_function2(theState->m_value); next_token(theState); - ret = new_expr(TE_PURE, func, { ret, expr_level8(theState) }); + ret = new_expr(TE_PURE, func, { ret, expr_level7(theState) }); } return ret; } //-------------------------------------------------- -te_expr* te_parser::expr_level8(te_parser::state* theState) +te_expr* te_parser::expr_level7(te_parser::state* theState) { /* = {(comparison operators) } */ - te_expr* ret = expr_level9(theState); + te_expr* ret = expr_level8(theState); while (theState->m_type == te_parser::state::token_type::TOK_INFIX && is_function2(theState->m_value) && @@ -1301,17 +1302,17 @@ te_expr* te_parser::expr_level8(te_parser::state* theState) { const te_fun2 func = get_function2(theState->m_value); next_token(theState); - ret = new_expr(TE_PURE, func, { ret, expr_level9(theState) }); + ret = new_expr(TE_PURE, func, { ret, expr_level8(theState) }); } return ret; } //-------------------------------------------------- -te_expr* te_parser::expr_level9(te_parser::state* theState) +te_expr* te_parser::expr_level8(te_parser::state* theState) { /* = {("<<" | ">>") } */ - te_expr* ret = expr_level10(theState); + te_expr* ret = expr_level9(theState); while (theState->m_type == te_parser::state::token_type::TOK_INFIX && is_function2(theState->m_value) && @@ -1320,14 +1321,14 @@ te_expr* te_parser::expr_level9(te_parser::state* theState) { const te_fun2 func = get_function2(theState->m_value); next_token(theState); - ret = new_expr(TE_PURE, func, { ret, expr_level10(theState) }); + ret = new_expr(TE_PURE, func, { ret, expr_level9(theState) }); } return ret; } //-------------------------------------------------- -te_expr* te_parser::expr_level10(te_parser::state* theState) +te_expr* te_parser::expr_level9(te_parser::state* theState) { /* = {("+" | "-") } */ te_expr* ret = term(theState); diff --git a/tinyexpr.h b/tinyexpr.h index 285901d..0d47079 100644 --- a/tinyexpr.h +++ b/tinyexpr.h @@ -1032,7 +1032,10 @@ class te_parser te_expr* expr_level1(state* theState); [[nodiscard]] te_expr* expr_level2(state* theState); - // levels 3-6 open for possible future extensions + // levels 3-5 open for possible future extensions + // of bitwise OR, XOR, and AND + [[nodiscard]] + te_expr* expr_level6(state* theState); [[nodiscard]] te_expr* expr_level7(state* theState); [[nodiscard]] @@ -1040,8 +1043,6 @@ class te_parser [[nodiscard]] te_expr* expr_level9(state* theState); [[nodiscard]] - te_expr* expr_level10(state* theState); - [[nodiscard]] te_expr* list(state* theState); std::string m_expression;