From 1bcf4be2aeb5c3a79229cd5da63daeced32f3efa Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Mon, 19 Oct 2009 23:12:54 +0000 Subject: [PATCH] parse ellipses in honu mode svn: r16375 --- src/mzscheme/src/read.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mzscheme/src/read.c b/src/mzscheme/src/read.c index 526bf8395e..99d650f7ea 100644 --- a/src/mzscheme/src/read.c +++ b/src/mzscheme/src/read.c @@ -117,6 +117,8 @@ static Scheme_Object *print_mpair_curly(int, Scheme_Object *[]); static Scheme_Object *print_honu(int, Scheme_Object *[]); static Scheme_Object *print_syntax_width(int, Scheme_Object *[]); +static int scheme_ellipses(mzchar* buffer, int length); + #define NOT_EOF_OR_SPECIAL(x) ((x) >= 0) #define mzSPAN(port, pos) () @@ -3607,7 +3609,8 @@ read_number_or_symbol(int init_ch, int skip_rt, Scheme_Object *port, return NULL; } - if (honu_mode && !is_symbol) { + /* special case for ellipses in honu */ + if (honu_mode && !is_symbol && !scheme_ellipses(buf, i)) { /* Honu inexact syntax is not quite a subset of Scheme: it can end in an "f" or "d" to indicate the precision. We can easily check whether the string has the right shape, and then move the "f" @@ -3653,7 +3656,8 @@ read_number_or_symbol(int init_ch, int skip_rt, Scheme_Object *port, } if (SAME_OBJ(o, scheme_false)) { - if (honu_mode && !is_symbol) { + /* special case for ellipses in honu */ + if (honu_mode && !is_symbol && !scheme_ellipses(buf, i)) { scheme_read_err(port, stxsrc, line, col, pos, SPAN(port, pos), 0, indentation, "read: bad number: %5", buf); return NULL; @@ -3791,6 +3795,10 @@ static int u_strcmp(mzchar *s, const char *_t) return 0; } +static int scheme_ellipses(mzchar* buffer, int length){ + return u_strcmp(buffer, "...") == 0; +} + /* "#\" has been read */ static Scheme_Object * read_character(Scheme_Object *port,