#define PSI_T_INT64 42
#define PSI_T_UINT64 43
#define PSI_T_FUNCTION 44
-#define PSI_T_AMPERSAND 45
-#define PSI_T_NULL 46
-#define PSI_T_TRUE 47
-#define PSI_T_FALSE 48
-#define PSI_T_DOLLAR 49
-#define PSI_T_CALLOC 50
-#define PSI_T_OBJVAL 51
-#define PSI_T_ARRVAL 52
-#define PSI_T_PATHVAL 53
-#define PSI_T_STRLEN 54
-#define PSI_T_STRVAL 55
-#define PSI_T_FLOATVAL 56
-#define PSI_T_INTVAL 57
-#define PSI_T_BOOLVAL 58
-#define PSI_T_TO_OBJECT 59
-#define PSI_T_TO_ARRAY 60
-#define PSI_T_TO_STRING 61
-#define PSI_T_TO_INT 62
-#define PSI_T_TO_FLOAT 63
-#define PSI_T_TO_BOOL 64
-#define PSI_T_MIXED 65
-#define PSI_T_ARRAY 66
-#define PSI_T_OBJECT 67
+#define PSI_T_NULL 45
+#define PSI_T_TRUE 46
+#define PSI_T_FALSE 47
+#define PSI_T_DOLLAR 48
+#define PSI_T_CALLOC 49
+#define PSI_T_OBJVAL 50
+#define PSI_T_ARRVAL 51
+#define PSI_T_PATHVAL 52
+#define PSI_T_STRLEN 53
+#define PSI_T_STRVAL 54
+#define PSI_T_FLOATVAL 55
+#define PSI_T_INTVAL 56
+#define PSI_T_BOOLVAL 57
+#define PSI_T_TO_OBJECT 58
+#define PSI_T_TO_ARRAY 59
+#define PSI_T_TO_STRING 60
+#define PSI_T_TO_INT 61
+#define PSI_T_TO_FLOAT 62
+#define PSI_T_TO_BOOL 63
+#define PSI_T_MIXED 64
+#define PSI_T_ARRAY 65
+#define PSI_T_OBJECT 66
+#define PSI_T_AMPERSAND 67
memcpy(type_->name, "unsigned", sizeof("unsigned")-1);
type_->name[sizeof("unsigned")] = ' ';
type_->name[T->size + sizeof("unsigned")] = 0;
+ free(T);
}
/* we have to support plain int here because we have it in our lexer rules */
decl_type(type_) ::= INT(T). {
%type impl_func {impl_func*}
%destructor impl_func {free_impl_func($$);}
-impl_func(func) ::= FUNCTION NSNAME(NAME) impl_args(args) COLON impl_type(type). {
- func = init_impl_func(NAME->text, args, type, 0);
- free(NAME);
-}
-impl_func(func) ::= FUNCTION AMPERSAND NSNAME(NAME) impl_args(args) COLON impl_type(type). {
- func = init_impl_func(NAME->text, args, type, 1);
+impl_func(func) ::= FUNCTION reference(r) NSNAME(NAME) impl_args(args) COLON impl_type(type). {
+ func = init_impl_func(NAME->text, args, type, r);
free(NAME);
}
%type impl_var {impl_var*}
%destructor impl_var {free_impl_var($$);}
-impl_var(var) ::= DOLLAR NAME(T). {
- var = init_impl_var(T->text, 0);
- free(T);
-}
-impl_var(var) ::= AMPERSAND DOLLAR NAME(T). {
- var = init_impl_var(T->text, 1);
+impl_var(var) ::= reference(r) DOLLAR NAME(T). {
+ var = init_impl_var(T->text, r);
free(T);
}
%destructor let_stmt {free_let_stmt($$);}
let_stmt(let) ::= LET decl_var(var) EOS. {
let = init_let_stmt(var, init_let_val(PSI_LET_NULL, NULL));
-}/*
-let_stmt(let) ::= LET decl_var(var) EQUALS let_val(val) EOS. {
- let = init_let_stmt(var, val);
-}*/
+}
let_stmt(let) ::= LET decl_var(var) EQUALS reference(r) let_val(val) EOS. {
val->flags.one.is_reference = r ? 1 : 0;
let = init_let_stmt(var, val);
let_val(val) ::= let_func(func). {
val = init_let_val(PSI_LET_FUNC, func);
}
-/*
-let_stmt(let) ::= LET decl_var(var) EQUALS reference(r) NULL EOS. {
- let = init_let_stmt(var, init_let_val(PSI_LET_NULL, NULL, r?PSI_LET_REFERENCE:0));
-}
-let_stmt(let) ::= LET decl_var(var) EQUALS reference(r) num_exp(exp) EOS. {
- let = init_let_stmt(var, init_let_val(PSI_LET_NUMEXP, exp, r?PSI_LET_REFERENCE:0));
-}
-let_stmt(let) ::= LET decl_var(var) EQUALS reference(r) CALLOC LPAREN let_calloc(alloc) RPAREN EOS. {
- let = init_let_stmt(var, init_let_val(PSI_LET_CALLOC, alloc, r?PSI_LET_REFERENCE:0));
-}
-let_stmt(let) ::= LET decl_var(var) EQUALS reference(r) let_func(func) EOS. {
- let = init_let_stmt(var, init_let_val(PSI_LET_FUNC, func, r?PSI_LET_REFERENCE:0));
-}
-let_stmt(let) ::= LET decl_var(var) EQUALS decl_var(val) EOS. {
- let = init_let_stmt(var, init_let_val(PSI_LET_VAR, val, 0));
-}
-*/
+
%type let_calloc {let_calloc*}
%destructor let_calloc {free_let_calloc($$);}
let_calloc(alloc) ::= num_exp(nmemb) COMMA num_exp(size). {
%destructor free_call {free_free_call($$);}
free_call(call) ::= NAME(F) LPAREN decl_vars(vars) RPAREN. {
call = init_free_call(F->text, vars);
+ free(F);
}
%token_class impl_type_token VOID MIXED BOOL INT FLOAT STRING ARRAY OBJECT.