Re: Error in the SRFI-30 formal specification Albumen Petrofsky 21 Jan 2003 03:30 UTC

I was saying:
>   <comment> ---> ; <all subsequent characters up to a line break>
>                | <srfi-30-comment>
>
>   <srfi-30-comment> ---> #| <srfi-30-comment-constituent>* |* |#
>
>   <srfi-30-comment-constituent> ---> #* <srfi-30-ordinary-char>
>                                    | |* <srfi-30-ordinary-char>
>                                    | #* <srfi-30-comment>
>
>   <srfi-30-ordinary-char> ---> <any character but # or |>

I thought I had included the following simple recursive implementation
with that message, but I realize now I left it out.  Here it is:

;; Reads the rest of a srfi-30 comment after the initial sharp and bar.
(define (read-rest-of-srfi-30-comment)
  (let ((c (read-char)))
    (if (eof-object? c) (error "EOF inside a srfi-30 comment"))
    (case c
      ((#\|)
       (case (peek-char)
	 ((#\#) (read-char))
	 (else (read-rest-of-srfi-30-comment))))
      ((#\#)
       (case (peek-char)
	 ((#\|) (read-char) (read-rest-of-srfi-30-comment)))
       (read-rest-of-srfi-30-comment))
      (else (read-rest-of-srfi-30-comment)))))

-al