zend_internal_arg_info *psi_internal_arginfo(impl *impl);
size_t psi_num_min_args(impl *impl);
void psi_to_int(impl_val *ret_val, decl_arg *func, zval *return_value);
+void psi_to_double(impl_val *ret_val, decl_arg *func, zval *return_value);
void psi_to_string(impl_val *ret_val, decl_arg *func, zval *return_value);
ZEND_RESULT_CODE psi_parse_args(zend_execute_data *execute_data, impl *impl);
impl_val *psi_do_let(decl_arg *darg);
}
}
+void psi_to_double(impl_val *ret_val, decl_arg *func, zval *return_value)
+{
+ RETVAL_DOUBLE(deref_impl_val(0, ret_val, func)->dval);
+}
+
void psi_to_string(impl_val *ret_val, decl_arg *func, zval *return_value)
{
switch (real_decl_type(func->type)->type) {
typedef struct decl_var {
char *name;
unsigned pointer_level;
+ unsigned array_size;
struct decl_arg *arg;
} decl_var;
-static inline decl_var *init_decl_var(char *name, unsigned pl) {
+static inline decl_var *init_decl_var(char *name, unsigned pl, unsigned as) {
decl_var *v = malloc(sizeof(*v));
v->name = (char *) strdup((const char *) name);
v->pointer_level = pl;
+ v->array_size = as;
return v;
}
TO_FLOAT = 'to_float';
TO_BOOL = 'to_bool';
NUMBER = [+-]? [0-9]* "."? [0-9]+ ([eE] [+-]? [0-9]+)?;
+ DIGITS = [0-9]+;
"#" .* "\n" { ++P->line; RETURN(PSI_T_COMMENT);}
"(" {RETURN(PSI_T_LPAREN);}
":" {RETURN(PSI_T_COLON);}
"{" {RETURN(PSI_T_LBRACE);}
"}" {RETURN(PSI_T_RBRACE);}
+ "[" {RETURN(PSI_T_LBRACKET);}
+ "]" {RETURN(PSI_T_RBRACKET);}
"=" {RETURN(PSI_T_EQUALS);}
"$" {RETURN(PSI_T_DOLLAR);}
"*" {RETURN(PSI_T_POINTER);}
TO_FLOAT {RETURN(PSI_T_TO_FLOAT);}
TO_BOOL {RETURN(PSI_T_TO_BOOL);}
NUMBER {RETURN(PSI_T_NUMBER);}
+ DIGITS {RETURN(PSI_T_DIGITS);}
NAME {RETURN(PSI_T_NAME);}
NSNAME {RETURN(PSI_T_NSNAME);}
QUOTED_STRING {RETURN(PSI_T_QUOTED_STRING);}
%type decl_var {decl_var*}
decl_var(var) ::= NAME(T). {
- var = init_decl_var(T->text, 0);
+ var = init_decl_var(T->text, 0, 0);
free(T);
}
decl_var(var) ::= pointers(p) NAME(T). {
- var = init_decl_var(T->text, p);
+ var = init_decl_var(T->text, p, 0);
free(T);
}
+decl_var(var) ::= NAME(T) LBRACKET DIGITS(D) RBRACKET. {
+ var = init_decl_var(T->text, 1, atol(D->text));
+ free(T);
+ free(D);
+}
+decl_var(var) ::= pointers(p) NAME(T) LBRACKET DIGITS(D) RBRACKET. {
+ var = init_decl_var(T->text, p+1, atol(D->text));
+ free(T);
+ free(D);
+}
%type decl_vars {decl_vars*}
decl_vars(vars) ::= decl_var(var). {