add read-time eval

This commit is contained in:
Yuichi Nishiwaki 2014-08-06 15:53:22 +09:00
parent e339b7c64a
commit d62727bef9
1 changed files with 14 additions and 0 deletions

View File

@ -149,6 +149,18 @@ read_directive(pic_state *pic, struct pic_port *port, int c)
return read_comment(pic, port, c);
}
static pic_value
read_eval(pic_state *pic, struct pic_port *port, int c)
{
pic_value form;
UNUSED(c);
form = read(pic, port, next(port));
return pic_eval(pic, form, pic->lib);
}
static pic_value
read_quote(pic_state *pic, struct pic_port *port, int c)
{
@ -655,6 +667,8 @@ read_dispatch(pic_state *pic, struct pic_port *port, int c)
return read_label(pic, port, c);
case 'u':
return read_unsigned_blob(pic, port, c);
case '.':
return read_eval(pic, port, c);
default:
read_error(pic, "unexpected dispatch character");
}