add fixnum
This commit is contained in:
@@ -15,7 +15,6 @@ struct parser_control {
|
||||
"(" return tLPAREN;
|
||||
")" return tRPAREN;
|
||||
[a-z0-9A-Z]+ { yylval.datum = pic_intern_cstr(p->pic, yytext); return tSYMBOL; }
|
||||
"'" return tQUOTE;
|
||||
|
||||
%%
|
||||
|
||||
|
||||
+12
@@ -6,6 +6,8 @@ pic_type(pic_value v)
|
||||
switch (v.type) {
|
||||
case PIC_VTYPE_NIL:
|
||||
return PIC_TT_NIL;
|
||||
case PIC_VTYPE_INT:
|
||||
return PIC_TT_INT;
|
||||
case PIC_VTYPE_HEAP:
|
||||
return ((struct pic_object *)v.u.data)->tt;
|
||||
}
|
||||
@@ -30,3 +32,13 @@ pic_obj_value(void *ptr)
|
||||
v.u.data = ptr;
|
||||
return v;
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_int_value(int i)
|
||||
{
|
||||
pic_value v;
|
||||
|
||||
v.type = PIC_VTYPE_INT;
|
||||
v.u.i = i;
|
||||
return v;
|
||||
}
|
||||
|
||||
+3
-2
@@ -20,7 +20,8 @@ pic_debug(pic_state *pic, pic_value obj)
|
||||
case PIC_TT_SYMBOL:
|
||||
printf("%s", pic_symbol_ptr(obj)->name);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
case PIC_TT_INT:
|
||||
printf("%d", pic_int(obj));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user