| 16 |
|
|
| 17 |
|
/* is child binary operation lower precedence than parent? */ |
| 18 |
|
static int |
| 19 |
< |
lower_precedent_binop(int typ, EPNODE *ekid) |
| 19 |
> |
lower_precedent_binop(int typ, EPNODE *ek) |
| 20 |
|
{ |
| 21 |
< |
if (ekid == NULL) |
| 21 |
> |
if (ek == NULL) |
| 22 |
|
return(0); |
| 23 |
|
switch (typ) { |
| 24 |
|
case '+': |
| 25 |
|
return(0); |
| 26 |
|
case '-': |
| 27 |
< |
return(ekid->type == '+'); |
| 27 |
> |
return(ek->type == '+'); |
| 28 |
|
case '*': |
| 29 |
< |
return(strchr("+-", ekid->type) != NULL); |
| 29 |
> |
return(strchr("+-", ek->type) != NULL); |
| 30 |
|
case '/': |
| 31 |
< |
return(strchr("+-*", ekid->type) != NULL); |
| 31 |
> |
return(strchr("+-*", ek->type) != NULL); |
| 32 |
|
case '^': |
| 33 |
< |
return(strchr("+-*/^", ekid->type) != NULL); |
| 33 |
> |
return(strchr("+-*/^", ek->type) != NULL); |
| 34 |
|
} |
| 35 |
|
return(0); /* child not binary op */ |
| 36 |
|
} |