diff --git a/NEWS b/NEWS index 3a42bd96..6f191f11 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ block-comments are all handled by the Scheme reader later. *** Keywords are supported. *** Cond now supports =>. *** Lambda* and define* are now supported. +*** #;-comment is now supported. * Changes in 0.3 since 0.2 ** Core *** Number-based rather than pointer-based cells. diff --git a/module/mes/read-0.mes b/module/mes/read-0.mes index ea854e16..1e77ddd7 100644 --- a/module/mes/read-0.mes +++ b/module/mes/read-0.mes @@ -133,6 +133,9 @@ ((eq? (peek-byte) 39) (read-byte) (cons (lookup (cons (integer->char 35) (cons (integer->char 39) (list))) a) (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) (cons (lookup (cons (integer->char 35) (cons (integer->char 96) (list))) a) (cons (read-word (read-byte) w a) (list)))) diff --git a/reader.c b/reader.c index 47d1b246..6698061c 100644 --- a/reader.c +++ b/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 () == '\\') {getchar (); return read_character ();} 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);} #endif //READER return read_word (getchar (), append2 (w, cons (make_char (c), cell_nil)), a); diff --git a/tests/read.test b/tests/read.test index 7bcdbf3b..3ebfe31d 100755 --- a/tests/read.test +++ b/tests/read.test @@ -32,6 +32,7 @@ cons #! barf !# +#;(bla) (display "must see!\n") (display `(display ,display)) (newline) (display `(display ,@'(string port))) (newline) (display #(0 1 2)) (newline)