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:
parent
1114122fbb
commit
cad6094cbc
2 changed files with 26 additions and 9 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue