parse ellipses in honu mode

svn: r16375
This commit is contained in:
Jon Rafkind 2009-10-19 23:12:54 +00:00
parent 3d60fe640b
commit 1bcf4be2ae

View File

@ -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,