From d62727bef95328f642573956585aad569519ad82 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Wed, 6 Aug 2014 15:53:22 +0900 Subject: [PATCH] add read-time eval --- src/read.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/read.c b/src/read.c index 8c9621ee..489426b5 100644 --- a/src/read.c +++ b/src/read.c @@ -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"); }