mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
[tinyexpr] Remove list()
This just read comma-separated expressions and returned the last of them, which is useless and confusing.
This commit is contained in:
parent
ea2934e644
commit
0fa0b620b3
1 changed files with 2 additions and 18 deletions
|
@ -200,7 +200,6 @@ static double sub(double a, double b) {return a - b;}
|
|||
static double mul(double a, double b) {return a * b;}
|
||||
static double divide(double a, double b) {return a / b;}
|
||||
static double negate(double a) {return -a;}
|
||||
static double comma(double a, double b) {(void)a; return b;}
|
||||
|
||||
|
||||
void next_token(state *s) {
|
||||
|
@ -272,7 +271,6 @@ void next_token(state *s) {
|
|||
}
|
||||
|
||||
|
||||
static te_expr *list(state *s);
|
||||
static te_expr *expr(state *s);
|
||||
static te_expr *power(state *s);
|
||||
|
||||
|
@ -353,7 +351,7 @@ static te_expr *base(state *s) {
|
|||
|
||||
case TOK_OPEN:
|
||||
next_token(s);
|
||||
ret = list(s);
|
||||
ret = expr(s);
|
||||
if (s->type == TOK_CLOSE) {
|
||||
next_token(s);
|
||||
} else if (s->type != TOK_ERROR) {
|
||||
|
@ -441,20 +439,6 @@ static te_expr *expr(state *s) {
|
|||
}
|
||||
|
||||
|
||||
static te_expr *list(state *s) {
|
||||
/* <list> = <expr> {"," <expr>} */
|
||||
te_expr *ret = expr(s);
|
||||
|
||||
while (s->type == TOK_SEP) {
|
||||
next_token(s);
|
||||
ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, expr(s));
|
||||
ret->function = comma;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define TE_FUN(...) ((double(*)(__VA_ARGS__))n->function)
|
||||
#define M(e) te_eval(n->parameters[e])
|
||||
|
||||
|
@ -535,7 +519,7 @@ te_expr *te_compile(const char *expression, const te_variable *variables, int va
|
|||
s.lookup_len = var_count;
|
||||
|
||||
next_token(&s);
|
||||
te_expr *root = list(&s);
|
||||
te_expr *root = expr(&s);
|
||||
|
||||
if (s.type != TOK_END) {
|
||||
te_free(root);
|
||||
|
|
Loading…
Reference in a new issue