diff --git a/src/builtin_math.cpp b/src/builtin_math.cpp index 6ae67677b..e6142f703 100644 --- a/src/builtin_math.cpp +++ b/src/builtin_math.cpp @@ -134,8 +134,8 @@ static const wchar_t *math_describe_error(te_error_t &error) { switch (error.type) { case TE_ERROR_NONE: DIE("Error has no position"); - case TE_ERROR_UNKNOWN_VARIABLE: - return _(L"Unknown variable"); + case TE_ERROR_UNKNOWN_FUNCTION: + return _(L"Unknown function"); case TE_ERROR_MISSING_CLOSING_PAREN: return _(L"Missing closing parenthesis"); case TE_ERROR_MISSING_OPENING_PAREN: diff --git a/src/tinyexpr.cpp b/src/tinyexpr.cpp index 035ea15b9..e134b6cb7 100644 --- a/src/tinyexpr.cpp +++ b/src/tinyexpr.cpp @@ -91,7 +91,7 @@ typedef struct state { te_error_type_t error; } state; -/* Parses the input expression and binds variables. */ +/* Parses the input expression. */ /* Returns NULL on error. */ te_expr *te_compile(const char *expression, te_error_t *error); @@ -234,7 +234,7 @@ void next_token(state *s) { s->value = strtod(s->next, const_cast(&s->next)); s->type = TOK_NUMBER; } else { - /* Look for a variable or builtin function call. */ + /* Look for a function call. */ // But not when it's an "x" followed by whitespace // - that's the alternative multiplication operator. if (s->next[0] >= 'a' && s->next[0] <= 'z' && @@ -260,7 +260,7 @@ void next_token(state *s) { } else if (s->type != TOK_ERROR || s->error == TE_ERROR_UNKNOWN) { // Our error is more specific, so it takes precedence. s->type = TOK_ERROR; - s->error = TE_ERROR_UNKNOWN_VARIABLE; + s->error = TE_ERROR_UNKNOWN_FUNCTION; } } else { /* Look for an operator or special character. */ @@ -329,7 +329,7 @@ static te_expr *expr(state *s); static te_expr *power(state *s); static te_expr *base(state *s) { - /* = | | {"(" ")"} | | + /* = | {"(" ")"} | | * "(" {"," } ")" | "(" ")" */ te_expr *ret; int arity; diff --git a/src/tinyexpr.h b/src/tinyexpr.h index bd6e93409..fec012fd4 100644 --- a/src/tinyexpr.h +++ b/src/tinyexpr.h @@ -29,7 +29,7 @@ typedef enum { TE_ERROR_NONE = 0, - TE_ERROR_UNKNOWN_VARIABLE = 1, + TE_ERROR_UNKNOWN_FUNCTION = 1, TE_ERROR_MISSING_CLOSING_PAREN = 2, TE_ERROR_MISSING_OPENING_PAREN = 3, TE_ERROR_TOO_FEW_ARGS = 4, diff --git a/tests/checks/math.fish b/tests/checks/math.fish index 381a26bed..b3cab0c4a 100644 --- a/tests/checks/math.fish +++ b/tests/checks/math.fish @@ -127,7 +127,7 @@ math 0x2 # Hex math 5 x 4 math 2x 4 math 2 x4 # ERROR -# CHECKERR: math: Error: Unknown variable +# CHECKERR: math: Error: Unknown function # CHECKERR: '2 x4' # CHECKERR: ^ math 0x 3