1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

Fix reading #!!#

* module/ice-9/read.scm (%read): Fix reading #!!#.
* test-suite/tests/reader.test ("reading"): Add some test cases.
This commit is contained in:
Andy Wingo 2021-03-07 19:59:01 +01:00
parent 1114122fbb
commit cad6094cbc
2 changed files with 26 additions and 9 deletions

View file

@ -731,16 +731,18 @@
(read-neoteric ch)))))
(define (read-directive)
(let ((ch (next)))
(define (directive-char? ch)
(and (char? ch)
(or (eqv? ch #\-)
(char-alphabetic? ch)
(char-numeric? ch))))
(let ((ch (peek)))
(cond
((eof-object? ch)
(error "unexpected end of input after #!"))
((directive-char? ch)
(next)
(string->symbol (take-while ch directive-char?)))
(else
(string->symbol
(take-while ch (lambda (ch)
(or (eqv? ch #\-)
(char-alphabetic? ch)
(char-numeric? ch)))))))))
#f))))
(define (skip-scsh-comment)
(let lp ((ch (next)))