read: datum comments

This commit is contained in:
Peter McGoron 2024-09-22 00:49:18 -04:00
parent 2e43f36471
commit f52235cc51
1 changed files with 9 additions and 0 deletions

View File

@ -436,10 +436,18 @@
port)))))) port))))))
loop)) loop))
;;; Reads the next toplevel datum, discards it, and then continues at the
;;; toplevel.
(define readtable:datum-comment
(lambda (_ __ toplevel port)
(readtable:next toplevel #f port)
(readtable:next toplevel #f port)))
(define readtable:hash (define readtable:hash
(readtable:process (readtable:process
(readtable:empty/default (readtable:error "unimplemented")) (readtable:empty/default (readtable:error "unimplemented"))
(list readtable:update #\| (readtable:jump/next readtable:block-comment)) (list readtable:update #\| (readtable:jump/next readtable:block-comment))
(list readtable:update #\; readtable:datum-comment)
(list readtable:update %bol readtable:vector))) (list readtable:update %bol readtable:vector)))
;;; ;;;;;;;;;;;;;;;; ;;; ;;;;;;;;;;;;;;;;
@ -498,3 +506,4 @@
(read-all "(x y #| this is a block\n comment\n |# z w)") (read-all "(x y #| this is a block\n comment\n |# z w)")
(read-all "#( a b #| this is a #| nested block |# comment|# z w)") (read-all "#( a b #| this is a #| nested block |# comment|# z w)")
(read-all "#(a b #(c #|close#|comment|#|#y))") (read-all "#(a b #(c #|close#|comment|#|#y))")
(read-all "(this has a #;(call with current continuation) datum comment)")