extra test cases and general cleanup

This commit is contained in:
Lewis Van Winkle
2020-10-02 17:27:26 -05:00
parent 0028d03082
commit a8f9bd99c2
5 changed files with 38 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
/*
* TINYEXPR - Tiny recursive descent parser and evaluation engine in C
*
* Copyright (c) 2015-2018 Lewis Van Winkle
* Copyright (c) 2015-2020 Lewis Van Winkle
*
* http://CodePlea.com
*
@@ -418,7 +418,6 @@ static te_expr *factor(state *s) {
te_expr *ret = power(s);
int neg = 0;
te_expr *insertion = 0;
if (ret->type == (TE_FUNCTION1 | TE_FLAG_PURE) && ret->function == negate) {
te_expr *se = ret->parameters[0];
@@ -427,6 +426,8 @@ static te_expr *factor(state *s) {
neg = 1;
}
te_expr *insertion = 0;
while (s->type == TOK_INFIX && (s->function == pow)) {
te_fun2 t = s->function;
next_token(s);