X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcontext.c;h=134acdd40dd69d8fb454a23535e6db0892f7b7e5;hp=44f82992e6e0ee1f739ea2aaa11aec137fc5f4ca;hb=2421d323be79e4a811a4197914330a8c0124b130;hpb=4b5ceb304b924c50eaf8263ad394493ff806fed4 diff --git a/src/context.c b/src/context.c index 44f8299..134acdd 100644 --- a/src/context.c +++ b/src/context.c @@ -439,6 +439,12 @@ static inline int validate_set_value(PSI_Data *data, set_value *set, decl_arg *r case PSI_T_TO_ARRAY: set->func->handler = psi_to_array; break; + case PSI_T_TO_OBJECT: + set->func->handler = psi_to_object; + break; + case PSI_T_VOID: + set->func->handler = psi_to_void; + break; EMPTY_SWITCH_DEFAULT_CASE(); } @@ -452,7 +458,8 @@ static inline int validate_set_value(PSI_Data *data, set_value *set, decl_arg *r if (set->count) { int is_to_array = (set->func->type == PSI_T_TO_ARRAY); int is_pointer_to_struct = (ref_type->type == PSI_T_STRUCT && ref->var->pointer_level); - if (is_to_array && !is_pointer_to_struct) { + + if (!is_to_array && !is_pointer_to_struct) { data->error(E_WARNING, "Inner `set` statement casts only work with " "to_array() casts on structs or pointers: %s(%s...", set->func->name, set->vars->vars[0]->name); return 0; @@ -959,9 +966,13 @@ void PSI_ContextBuild(PSI_Context *C, const char *paths) continue; } - while (-1 != PSI_ParserScan(&P)) { + while (0 < PSI_ParserScan(&P)) { PSI_ParserParse(&P, PSI_TokenAlloc(&P)); - }; + if (P.num == PSI_T_EOF) { + break; + } + } + PSI_ParserParse(&P, NULL); PSI_ContextValidate(C, &P); PSI_ParserDtor(&P); @@ -1024,6 +1035,7 @@ zend_function_entry *PSI_ContextCompile(PSI_Context *C) void PSI_ContextCall(PSI_Context *C, impl_val *ret_val, decl *decl) { + errno = 0; C->ops->call(C, ret_val, decl); }