Support #; comment.
* module/mes/read-0.mes (read-word): Implement #;. * reader.c (read_word)[READER]: Likewise. * tests/read.test: Test it. * NEWS: Mention it.
This commit is contained in:
parent
a8b16ba013
commit
9dcff14bba
1
NEWS
1
NEWS
|
@ -20,6 +20,7 @@ block-comments are all handled by the Scheme reader later.
|
||||||
*** Keywords are supported.
|
*** Keywords are supported.
|
||||||
*** Cond now supports =>.
|
*** Cond now supports =>.
|
||||||
*** Lambda* and define* are now supported.
|
*** Lambda* and define* are now supported.
|
||||||
|
*** #;-comment is now supported.
|
||||||
* Changes in 0.3 since 0.2
|
* Changes in 0.3 since 0.2
|
||||||
** Core
|
** Core
|
||||||
*** Number-based rather than pointer-based cells.
|
*** Number-based rather than pointer-based cells.
|
||||||
|
|
|
@ -133,6 +133,9 @@
|
||||||
((eq? (peek-byte) 39) (read-byte)
|
((eq? (peek-byte) 39) (read-byte)
|
||||||
(cons (lookup (cons (integer->char 35) (cons (integer->char 39) (list))) a)
|
(cons (lookup (cons (integer->char 35) (cons (integer->char 39) (list))) a)
|
||||||
(cons (read-word (read-byte) w a) (list))))
|
(cons (read-word (read-byte) w a) (list))))
|
||||||
|
((eq? (peek-byte) 59) (read-byte)
|
||||||
|
(read-word (read-byte) w a)
|
||||||
|
(read-word (read-byte) w a))
|
||||||
((eq? (peek-byte) 96) (read-byte)
|
((eq? (peek-byte) 96) (read-byte)
|
||||||
(cons (lookup (cons (integer->char 35) (cons (integer->char 96) (list))) a)
|
(cons (lookup (cons (integer->char 35) (cons (integer->char 96) (list))) a)
|
||||||
(cons (read-word (read-byte) w a) (list))))
|
(cons (read-word (read-byte) w a) (list))))
|
||||||
|
|
1
reader.c
1
reader.c
|
@ -94,6 +94,7 @@ read_word (int c, SCM w, SCM a)
|
||||||
if (c == '#' && peekchar () == 'x') {getchar (); return read_hex ();}
|
if (c == '#' && peekchar () == 'x') {getchar (); return read_hex ();}
|
||||||
if (c == '#' && peekchar () == '\\') {getchar (); return read_character ();}
|
if (c == '#' && peekchar () == '\\') {getchar (); return read_character ();}
|
||||||
if (c == '#' && w == cell_nil && peekchar () == '(') {getchar (); return list_to_vector (read_list (a));}
|
if (c == '#' && w == cell_nil && peekchar () == '(') {getchar (); return list_to_vector (read_list (a));}
|
||||||
|
if (c == '#' && peekchar () == ';') {getchar (); read_word (getchar (), w, a); return read_word (getchar (), w, a);}
|
||||||
if (c == '#' && peekchar () == '!') {getchar (); read_block_comment (getchar ()); return read_word (getchar (), w, a);}
|
if (c == '#' && peekchar () == '!') {getchar (); read_block_comment (getchar ()); return read_word (getchar (), w, a);}
|
||||||
#endif //READER
|
#endif //READER
|
||||||
return read_word (getchar (), append2 (w, cons (make_char (c), cell_nil)), a);
|
return read_word (getchar (), append2 (w, cons (make_char (c), cell_nil)), a);
|
||||||
|
|
|
@ -32,6 +32,7 @@ cons
|
||||||
#!
|
#!
|
||||||
barf
|
barf
|
||||||
!#
|
!#
|
||||||
|
#;(bla) (display "must see!\n")
|
||||||
(display `(display ,display)) (newline)
|
(display `(display ,display)) (newline)
|
||||||
(display `(display ,@'(string port))) (newline)
|
(display `(display ,@'(string port))) (newline)
|
||||||
(display #(0 1 2)) (newline)
|
(display #(0 1 2)) (newline)
|
||||||
|
|
Loading…
Reference in a new issue