tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 803c6ea7ce96c1809b5d44edc9a12fd1d587ea8b
parent 96571e5e1762874d403000ccdb78b327835e3a2b
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Tue,  3 Apr 2018 18:30:47 -0700

Read single quote character as quote primitive

Diffstat:
t/prim/quote.expect | 3+++
t/prim/quote.tsp | 4++++
tisp.c | 6+++++-
3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/t/prim/quote.expect b/t/prim/quote.expect @@ -5,3 +5,6 @@ bar (1 2 3 4) (quote 1) (+ 2 2) +12 +foo +(1 2 3 4) diff --git a/t/prim/quote.tsp b/t/prim/quote.tsp @@ -5,3 +5,7 @@ (quote (1 2 3 4)) (quote (quote 1)) (quote (+ 2 2)) + +'12 +'foo +'(1 2 3 4) diff --git a/tisp.c b/tisp.c @@ -328,8 +328,12 @@ tisp_read(Str str) skip_spaces(str); if (isdigit(*str->d)) /* TODO negative numbers */ return read_int(str); - if (*str->d == '"') /* TODO fix */ + if (*str->d == '"') return read_str(str); + if (*str->d == '\'') { + str->d++; + return mk_pair(mk_sym("quote"), mk_pair(tisp_read(str), &nil)); + } if (issym(*str->d)) return read_sym(str); if (*str->d == '(')