- case PSI_T_NAME:
- if (current_enum && psi_num_exp_validate_enum(data, exp, current_enum)) {
- return true;
- }
- while (psi_plist_get(data->enums, i++, &enm)) {
- if (psi_num_exp_validate_enum(data, exp, enm)) {
- return true;
- }
- }
- if (exp->data.dvar->arg) {
- return true;
- }
- if (psi_decl_var_validate(data, exp->data.dvar, impl ? impl->decl : NULL,
- current_let, current_set)) {
- return true;
- }
- if (cb_decl && psi_decl_var_validate(data, exp->data.dvar, cb_decl, NULL, NULL)) {
- return true;
- }
- data->error(data, exp->token, PSI_WARNING,
- "Unknown variable '%s' in numeric expression",
- exp->data.dvar->name);
- return false;
-
- case PSI_T_NSNAME:
- while (psi_plist_get(data->consts, i++, &cnst)) {
- if (!strcmp(cnst->name, exp->data.numb)) {
- free(exp->data.numb);
- exp->type = PSI_T_CONST;
- exp->data.cnst = cnst;
- return true;
- }
- }
- data->error(data, exp->token, PSI_WARNING,
- "Unknown constant '%s' in numeric expression",
- exp->data.numb);
- return false;
-
- case PSI_T_NUMBER:
- switch (is_numeric_string(exp->data.numb, strlen(exp->data.numb), (zend_long *) &tmp, (double *) &tmp, 0)) {
- case IS_LONG:
- free(exp->data.numb);
- exp->type = PSI_T_INT64;
- exp->data.ival.i64 = tmp.zend.lval;
- return true;
-
- case IS_DOUBLE:
- free(exp->data.numb);
- exp->type = PSI_T_DOUBLE;
- exp->data.ival.dval = tmp.dval;
- return true;
- }
- data->error(data, exp->token, PSI_WARNING, "Expected numeric entity (parser error?)");
- return false;