From: Raimondas Kiveris
Subject: Re: How to read from a file which has `:'?
Date:
Message-ID: <60stcf$ru2$1@nfs.kolumbus.fi>
In article <·············@WINTERMUTE.eagle>,
SDS <···········@cctrading.com> wrote:
>I have to read from a file (a stream) which contains some text with
>numbers, so I want the numbers to be parsed, but I don't want to be
>pestered by error messages that #zzz is undefined and xxx is not a valid
>package name (when the file has "xxx:" in it).
What a coincidence. I was wrestling with the same problem couple of
days ago.
The solution that worked for me was to make #\: a terminating
character with
(set-macro-character #\: (get-macro-character #\a)
nil *parser-rt*)
That leaves me with (XX |:2|) when reading token XX:2
so I have to filter the result of read through function that
assembles (XX |:2|) back into |XX:2|. Not very efficient.
I wonder too if there is an elegant solution to this problem
Thanks,
=Rai
From: Raimondas Kiveris
Subject: Re: How to read from a file which has `:'?
Date:
Message-ID: <60vtnp$g51$1@nfs.kolumbus.fi>
In article <·············@WINTERMUTE.eagle>,
SDS <···········@cctrading.com> wrote:
>>>>> In a very interesting message <············@nfs.kolumbus.fi>
>>>>> Sent on 1 Oct 1997 07:16:31 GMT
>>>>> Honorable ········@u.comptel.fi (Raimondas Kiveris) writes
>>>>> on the subject of "Re: How to read from a file which has `:'?":
> >>
> >> In article <·············@WINTERMUTE.eagle>,
> >> SDS <···········@cctrading.com> wrote:
> >> >I have to read from a file (a stream) which contains some text with
> >> >numbers, so I want the numbers to be parsed, but I don't want to be
> >> >pestered by error messages that #zzz is undefined and xxx is not a valid
> >> >package name (when the file has "xxx:" in it).
> >>
> >> The solution that worked for me was to make #\: a terminating
> >> character with
> >> (set-macro-character #\: (get-macro-character #\a)
> >> nil *parser-rt*)
>
>Interesting. But (get-macro-character #\a) returns nil, which is not a
>function, so this signals an error.
Bummer!
This must be implementation-dependant thing then.
On Allegro CL 4.3:
USER(1): (get-macro-character #\a)
#<Function READ-TOKEN>
T
USER(2): (apropos "READ-TOKEN")
EXCL::READ-TOKEN [function] (STREAM FIRSTCHAR)
Sorry about the confusion
=Rai