[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Handling unstandard reader macros.

From: Pupeno
Subject: Re: [Chicken-users] Handling unstandard reader macros.
Date: Wed, 23 Nov 2005 00:40:09 -0300
User-agent: KMail/1.8.3

On Tuesday 22 November 2005 03:26, felix winkelmann wrote:
> On 11/21/05, Pupeno <address@hidden> wrote:
> > > You only need to handle compiler-specifiic syntax, which is mainly
> > > #> ... <#-
> >
> > Why ? I already handle that and I already encountered cases where I'd
> > have to handle <<EOF and similar.
> The standard reader should handle #<<... by default.
In my case, it didn't, I even had to add support for #t and #f.

> > BTW, what should I return from my procedures that handle extensions. I
> > was returning '() but that causes an error, I am now returning
> > '(nevermind) since I don't care about it.
> Sorry, what kind of procedures are that?
The procedure that is set by set-read-syntax![1].

Thank you.
Pupeno <address@hidden> (

[1] In my case:
  (set-read-syntax! #\#
    (lambda (port)
      (let ((first-char (read-char port)))
;;        (display (format "Found a reader macro starting with: ~s.~n" 
         ((char=? first-char #\>)
          (let loop ((c (read-char port)))
;;            (display (format "Retriving char: ~s.~n" c))
            (if (and (char=? c #\<)
                     (char=? (peek-char port) #\#))
                  (read-char port)
                (loop (read-char port)))))
         ((or (char=? first-char #\f)
              (char=? first-char #\t))
          (with-output-to-port (current-error-port)
            (lambda ()
              (display "Non-supported reader macro extension found:")
              (display first-char)
              (display (read-string 50 port))
              (display " ...")
              (exit 1))))))))

Attachment: pgponlwy40vBT.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]