You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-3
Original file line number
Diff line number
Diff line change
@@ -776,7 +776,7 @@ The main use of this might be to map between names in a language which uses lots
776
776
### Package, module
777
777
`cs-forms` lives in `org.tfeb.hax.cs-forms` and provides `:org.tfeb.hax.cs-forms`.
778
778
779
-
###Reading forms in a package: `read-package`
779
+
## Reading forms in a package: `read-package`
780
780
Symbolics LispMs had a nice syntax where package prefixes applied generally: `foo:(x y z)` meant either the same as `(foo:x foo:y foo:z)` or possibly `(foo::x foo::y foo::z)`, I'm not sure now. This can't be done in standard CL as by the time the package prefix has been read you're already committed to reading a symbol. But this hack lets you do something similar:
781
781
782
782
```lisp
@@ -803,6 +803,8 @@ This all works by a fairly nasty hack: the package is read as (probably) a symbo
803
803
804
804
It may be that some current CL implementations can do the native Symbolics-style thing too, and if they can it's probably better than this hack.
805
805
806
+
When `*read-suppress*` is true, the reader simply calls `read` twice and returns `nil`.
807
+
806
808
### Package, module
807
809
`read-package` lives in `org.tfeb.hax.read-package` and provides `:org.tfeb.hax.read-package`.
808
810
@@ -1295,7 +1297,7 @@ The algorithm for reading a special string is:
1295
1297
- if is is a special character, then read the next character
1296
1298
- if it is the delimiter this is an error (if you want to escape the delimiter, use the escape character);
1297
1299
- otherwise find either its handler or the fallback handler for that special character, then call the handler with four arguments: the special character, the character after it, the delimiter and the stream;
1298
-
- the handler function should return: a character which is accumulated; a list of characters which are accumulated (this list may be empty); or a string, the characters of which are accumulate. Any other return value is an error.
1300
+
- the handler function should return: a character which is accumulated; a list of characters which are accumulated (this list may be empty); or a string, the characters of which are accumulated. Any other return value is an error.
1299
1301
1300
1302
An end of file before an unescaped delimiter is reached is an error.
1301
1303
@@ -1381,7 +1383,9 @@ This function relies on some slightly non-standard characters: I think they exis
1381
1383
### Notes
1382
1384
As mentioned above, a lot of the interface is trying to mirror the standard readtable interface, which is why it's a bit ugly.
1383
1385
1384
-
I've talked about things 'being an error' above: in fact in most (I hope all) cases suitable conditions are signaled
1386
+
I've talked about things 'being an error' above: in fact in most (I hope all) cases suitable conditions are signalled.
1387
+
1388
+
When `*read-suppress*` is true, then reading a special string will still call its handlers: this is necessary because the handlers can absorb arbitrary characters from the stream. But the results of the handlers are simply ignored and no string is built. An alternative would simply be not to call the handlers and assume they are well-behaved, but I decided not to do that. User-defined handlers should, if need be, notice `*read-suppress*`and behave appropriately, for instance by not building a big list of characters to return when reading is suppressed.
1385
1389
1386
1390
Stringtables are intended to provide a way of reading literal strings with some slightly convenient syntax[^12]: it is *not* a system for, for instance, doing some syntactically-nicer or more extensible version of what `format` does. There are other things which do that, I'm sure.
0 commit comments