mes.c: grok #\tab.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-24 12:06:05 +02:00
parent d4e335b447
commit 478087abe4

10
mes.c
View file

@ -840,7 +840,8 @@ display_helper (scm *x, bool cont, char *sep, bool quote)
{ {
scm *r; scm *r;
printf ("%s", sep); printf ("%s", sep);
if (x->type == CHAR && x->value == 10) printf ("#\\%s", "newline"); if (x->type == CHAR && x->value == 9) printf ("#\\%s", "tab");
else if (x->type == CHAR && x->value == 10) printf ("#\\%s", "newline");
else if (x->type == CHAR && x->value == 32) printf ("#\\%s", "space"); else if (x->type == CHAR && x->value == 32) printf ("#\\%s", "space");
else if (x->type == CHAR) printf ("#\\%c", x->value); else if (x->type == CHAR) printf ("#\\%c", x->value);
else if (x->type == MACRO) { else if (x->type == MACRO) {
@ -1016,10 +1017,11 @@ readchar ()
*p++ = getchar (); *p++ = getchar ();
} }
*p = 0; *p = 0;
if (!strcmp (buf, "newline")) c = 10; if (!strcmp (buf, "tab")) c = 9;
else if (!strcmp (buf, "newline")) c = 10;
else if (!strcmp (buf, "space")) c = 32; else if (!strcmp (buf, "space")) c = 32;
else { else {
printf ("char not supported: %s", buf); fprintf (stderr, "char not supported: %s\n", buf);
assert (!"char not supported"); assert (!"char not supported");
} }
} }
@ -1046,7 +1048,7 @@ readstring ()
int int
eat_whitespace (int c) eat_whitespace (int c)
{ {
while (c == ' ' || c == '\n') c = getchar (); while (c == ' ' || c == '\t' || c == '\n') c = getchar ();
if (c == ';') return eat_whitespace (readcomment (c)); if (c == ';') return eat_whitespace (readcomment (c));
if (c == '#' && peekchar () == '!') {getchar (); readblock (getchar ()); return eat_whitespace (getchar ());} if (c == '#' && peekchar () == '!') {getchar (); readblock (getchar ()); return eat_whitespace (getchar ());}
return c; return c;