Support #\alarm, #\vtab.

* mes.c (char_alarm): New variable.
  (char_vtab): Rename from char_vt.
* reader.c (read_character): Add alarm, update vtab.
* display.c (display): Likewise.
* module/language/c/lexer.mes (read-string): Use vtab.
This commit is contained in:
Jan Nieuwenhuizen 2016-12-18 15:21:05 +01:00
parent 95d913097d
commit 89f771f18a
4 changed files with 8 additions and 5 deletions

View file

@ -58,10 +58,11 @@ display_helper (FILE* f, SCM x, bool cont, char const *sep, bool quote)
{ {
char const *name = 0; char const *name = 0;
if (VALUE (x) == char_nul.value) name = char_nul.name; if (VALUE (x) == char_nul.value) name = char_nul.name;
else if (VALUE (x) == char_alarm.value) name = char_alarm.name;
else if (VALUE (x) == char_backspace.value) name = char_backspace.name; else if (VALUE (x) == char_backspace.value) name = char_backspace.name;
else if (VALUE (x) == char_tab.value) name = char_tab.name; else if (VALUE (x) == char_tab.value) name = char_tab.name;
else if (VALUE (x) == char_newline.value) name = char_newline.name; else if (VALUE (x) == char_newline.value) name = char_newline.name;
else if (VALUE (x) == char_vt.value) name = char_vt.name; else if (VALUE (x) == char_vtab.value) name = char_vtab.name;
else if (VALUE (x) == char_page.value) name = char_page.name; else if (VALUE (x) == char_page.value) name = char_page.name;
else if (VALUE (x) == char_return.value) name = char_return.name; else if (VALUE (x) == char_return.value) name = char_return.name;
else if (VALUE (x) == char_space.value) name = char_space.name; else if (VALUE (x) == char_space.value) name = char_space.name;

3
mes.c
View file

@ -131,10 +131,11 @@ scm scm_symbol_cons = {SYMBOL, "cons"};
scm char_eof = {CHAR, .name="*eof*", .value=-1}; scm char_eof = {CHAR, .name="*eof*", .value=-1};
scm char_nul = {CHAR, .name="nul", .value=0}; scm char_nul = {CHAR, .name="nul", .value=0};
scm char_alarm = {CHAR, .name="alarm", .value=8};
scm char_backspace = {CHAR, .name="backspace", .value=8}; scm char_backspace = {CHAR, .name="backspace", .value=8};
scm char_tab = {CHAR, .name="tab", .value=9}; scm char_tab = {CHAR, .name="tab", .value=9};
scm char_newline = {CHAR, .name="newline", .value=10}; scm char_newline = {CHAR, .name="newline", .value=10};
scm char_vt = {CHAR, .name="vt", .value=11}; scm char_vtab = {CHAR, .name="vtab", .value=11};
scm char_page = {CHAR, .name="page", .value=12}; scm char_page = {CHAR, .name="page", .value=12};
scm char_return = {CHAR, .name="return", .value=13}; scm char_return = {CHAR, .name="return", .value=13};
scm char_space = {CHAR, .name="space", .value=32}; scm char_space = {CHAR, .name="space", .value=32};

View file

@ -158,7 +158,7 @@
((#\n) #\newline) ((#\n) #\newline)
((#\r) #\return) ((#\r) #\return)
((#\t) #\tab) ((#\t) #\tab)
((#\v) #\vt) ((#\v) #\vtab)
((#\0) ((#\0)
(let ((next (peek-char))) (let ((next (peek-char)))
(cond (cond
@ -402,7 +402,7 @@
;;(display "next-token c=") (display c) (newline) ;;(display "next-token c=") (display c) (newline)
(case c (case c
((#\tab #\vt #\page #\space ;;#\x00A0 ((#\tab #\vtab #\page #\space ;;#\x00A0
) ; whitespace ) ; whitespace
(read-char) (read-char)
(next-token div?)) (next-token div?))

View file

@ -122,10 +122,11 @@ read_character ()
} }
*p = 0; *p = 0;
if (!strcmp (buf, char_nul.name)) c = char_nul.value; if (!strcmp (buf, char_nul.name)) c = char_nul.value;
else if (!strcmp (buf, char_alarm.name)) c = char_alarm.value;
else if (!strcmp (buf, char_backspace.name)) c = char_backspace.value; else if (!strcmp (buf, char_backspace.name)) c = char_backspace.value;
else if (!strcmp (buf, char_tab.name)) c = char_tab.value; else if (!strcmp (buf, char_tab.name)) c = char_tab.value;
else if (!strcmp (buf, char_newline.name)) c = char_newline.value; else if (!strcmp (buf, char_newline.name)) c = char_newline.value;
else if (!strcmp (buf, char_vt.name)) c = char_vt.value; else if (!strcmp (buf, char_vtab.name)) c = char_vtab.value;
else if (!strcmp (buf, char_page.name)) c = char_page.value; else if (!strcmp (buf, char_page.name)) c = char_page.value;
else if (!strcmp (buf, char_return.name)) c = char_return.value; else if (!strcmp (buf, char_return.name)) c = char_return.value;
else if (!strcmp (buf, char_space.name)) c = char_space.value; else if (!strcmp (buf, char_space.name)) c = char_space.value;