token_t t;
union {
char *numb;
- char *cnst;
+ constant *cnst;
decl_var *dvar;
} u;
token_t operator;
+ int (*calculator)(int t1, impl_val *v1, int t2, impl_val *v2, impl_val *res);
struct num_exp *operand;
} num_exp;
num_exp *exp = calloc(1, sizeof(*exp));
switch (exp->t = t) {
case PSI_T_NUMBER:
- exp->u.numb = strdup(num);
- break;
case PSI_T_NSNAME:
- exp->u.cnst = strdup(num);
+ exp->u.numb = strdup(num);
break;
case PSI_T_NAME:
exp->u.dvar = num;
free(exp->u.numb);
break;
case PSI_T_NSNAME:
- free(exp->u.cnst);
break;
case PSI_T_NAME:
free_decl_var(exp->u.dvar);