I'm trying to change the readtable in such a way that it ignores certain
characters, but such that those characters do not start a new token. I
just want to be able to read in such a way that certain characters are
invisible. As near as I can tell, this cannot be done. The only solution
I have is to read in the text, remove the offending characters, and then
read the text. Not as efficient as I had hoped.
I'm I missing something? Thanks.
--
Christopher J. Vogt ····@netcom.COM
From: El Eh, CA
On Tue, 2 Mar 1993 18:03:15 GMT, ····@netcom.com (Christopher J. Vogt) said:
>I'm trying to change the readtable in such a way that it ignores certain
>characters, but such that those characters do not start a new token. I
>just want to be able to read in such a way that certain characters are
>invisible. As near as I can tell, this cannot be done. The only solution
>I have is to read in the text, remove the offending characters, and then
>read the text. Not as efficient as I had hoped.
>I'm I missing something? Thanks.
>--
>Christopher J. Vogt ····@netcom.COM
>From: El Eh, CA
One way to have the reader ignore certain characters is to set that
character to ';'. This way, it treats it as a comment. Then, you
can just skip over this (using the value returned by read-from-string for
example), and continue reading. Here's a couple of e.g.s
Make '_' ignored:
(set-syntax-from-char #\_ #\;)
Make ':' ignored:
(set-syntax-from-char #\: #\;)
Make sure you reset them (i.e. save a copy of the readtable and restore it
after you're done). An unwind-protect can be useful in these cases.
-- Drew
--
============================================================
Drew J. Asson ·····@stsci.edu
Advance Planning Systems Group (410) 338-4474
Space Telescope Science Institute
3700 San Martin Drive
Baltimore, MD 21218