darcs get http://common-lisp.net/project/editor-hints/darcs/named-readtables/
COPY-NAMED-READTABLE
DEFREADTABLE
ENSURE-READTABLE
FIND-READTABLE
IN-READTABLE
LIST-ALL-NAMED-READTABLES
MAKE-READTABLE
MERGE-READTABLES-INTO
NAMED-READTABLE-DESIGNATOR
READER-MACRO-CONFLICT
READTABLE-DOES-ALREADY-EXIST
READTABLE-DOES-NOT-EXIST
READTABLE-NAME
REGISTER-READTABLE
RENAME-READTABLE
UNREGISTER-READTABLE
API heavily imitates the API of packages. This has the nice property that any experienced DEFREADTABLE - DEFPACKAGE
IN-READTABLE - IN-PACKAGE
MERGE-READTABLES-INTO - USE-PACKAGE
MAKE-READTABLE - MAKE-PACKAGE
UNREGISTER-READTABLE - DELETE-PACKAGE
RENAME-READTABLE - RENAME-PACKAGE
FIND-READTABLE - FIND-PACKAGE
READTABLE-NAME - PACKAGE-NAME
LIST-ALL-NAMED-READTABLES - LIST-ALL-PACKAGES
API of Named-Readtables, and the API of packages.
1. Readtable names are symbols not strings.
CL-ORACLE:SQL-SYNTAX and CL-MYSQL:SQL-SYNTAX can happily coexist SCHEME:SYNTAX and ELISP:SYNTAX.
2. The inheritance is resolved statically, not dynamically.
3. DEFREADTABLE does not have compile-time effects.
DEFPACKAGE, you can make that package the currently active package for IN-PACKAGE. The same is, however, not true for DEFREADTABLE and IN-READTABLE for the following reason:
DEFREADTABLE had compile-time effects, you'd have to wrap each definition of a EVAL-WHEN to make its definition available at compile-time. Because DEFREADTABLE does not have a compile-time effect.
DEFREADTABLE and EVAL-WHEN.
NIL, :STANDARD, and :COMMON-LISP designate the standard readtable.
:MODERN designates a case-preserving standard-readtable.
:CURRENT designates the current readtable.
(defreadtable elisp:syntax
(:merge :standard)
(:macro-char #\? #'elisp::read-character-literal t)
(:macro-char #\[ #'elisp::read-vector-literal t)
...
(:case :preserve))
(defreadtable scheme:syntax
(:merge :standard)
(:macro-char #\[ #'(lambda (stream char)
(read-delimited-list #\] stream)))
(:macro-char #\# :dispatch)
(:dispatch-macro-char #\# #\t #'scheme::read-#t)
(:dispatch-macro-char #\# #\f #'scheme::read-#f)
...
(:case :preserve))
(in-readtable elisp:syntax)
...
(in-readtable scheme:syntax)
...
[Function]
copy-named-readtable named-readtable => result
Argument and Values:
named-readtable: (OR
READTABLE
SYMBOL)result: READTABLE Description:
Likebut takes aCOPY-READTABLEas argument.NAMED-READTABLE-DESIGNATOR
[Macro]
defreadtable name &body options => result
Description:
Define a new named readtable, whose name is given by the symbol name. Or, if a readtable is
already registered under that name, redefine that one.
The readtable can be populated using the following options:
(:MERGEreadtable-designators+)
Merge the readtables designated into the new readtable being defined as perMERGE-READTABLES-INTO.
If no:MERGEclause is given, an empty readtable is used. SeeMAKE-READTABLE.
(:FUZEreadtable-designators+)
Like:MERGEexcept:
Error conditions of typethat are signaled during the merge operation willREADER-MACRO-CONFLICT
be silently continued. It follows that reader macros in earlier entries will be overwritten by
later ones.
(:DISPATCH-MACRO-CHARmacro-char sub-char function)
Define a new sub character sub-char for the dispatching macro character macro-char,
perYou probably have to define macro-char as a dispatchingSET-DISPATCH-MACRO-CHARACTER.
macro character by the following option first.
(:MACRO-CHARmacro-char function [non-terminating-p])
Define a new macro character in the readtable, perIf function is theSET-MACRO-CHARACTER.
keyword:DISPATCH,macro-char is made a dispatching macro character, per
MAKE-DISPATCH-MACRO-CHARACTER.
(:SYNTAX-FROMfrom-readtable-designator from-char to-char)
Set the character syntax of to-char in the readtable being defined to the same syntax as
from-char as perSET-SYNTAX-FROM-CHAR.
(:CASEcase-mode)
Defines the case sensitivity mode of the resulting readtable.
Any number of option clauses may appear. The options are grouped by their type, but in each group
the order the options appeared textually is preserved. The following groups exist and are executed
in the following order::MERGEand:FUZE(one group),:CASE,:MACRO-CHARand:DISPATCH-MACRO-CHAR
(one group), finally:SYNTAX-FROM.
Notes:
The readtable is defined at load-time. If you want to have it available at compilation timesay--
to use its reader-macros in the same file as its definitionyou have to wrap the--DEFREADTABLE
form in an explicitEVAL-WHEN.
On redefinition, the target readtable is made empty first before it's refilled according to
the clauses.
NIL,:STANDARD,:COMMON-LISP,:MODERN,and:CURRENTare preregistered readtable names.
[Function]
ensure-readtable name &optional default => result
Argument and Values:
name: (OR
READTABLE
SYMBOL)default: (OR
READTABLE
SYMBOL)result: READTABLE Description:
Looks up the readtable specified by name and returns it if it's found. If it is not
found, it registers the readtable designated by default under the name represented by
name; or if no default argument is given, it signals an error of type
instead.READTABLE-DOES-NOT-EXIST
[Function]
find-readtable name => result
Argument and Values:
name: (OR
READTABLE
SYMBOL)result: (OR
READTABLE
NULL) Description:
Looks for the readtable specified by name and returns it if it is found. ReturnsNIL
otherwise.
[Macro]
in-readtable name => result
Description:
Set *READTABLE* to the readtable referred to by the symbol name.
[Function]
list-all-named-readtables => result
Argument and Values:
result: LIST Description:
Returns a list of all registered readtables. The returned list is guaranteed to be fresh, but may
contain duplicates.
[Function]
make-readtable &optional name &key merge => result
Argument and Values:
name: (OR
READTABLE
SYMBOL)merge: LISTresult: READTABLE Description:
Creates and returns a new readtable under the specified name.
merge takes a list ofand specifies the readtables the newNAMED-READTABLE-DESIGNATORS
readtable is created from. (See the:MERGEclause offor details.)DEFREADTABLE
If merge isNIL,an empty readtable is used instead.
If name is not given, an anonymous empty readtable is returned.
Notes:
An empty readtable is a readtable where each character's syntax is the same as in the
standard readtable except that each macro character has been made a constituent. Basically:
whitespace stays whitespace, everything else is constituent.
[Function]
merge-readtables-into result-readtable &rest named-readtables => result
Argument and Values:
result-readtable: (OR
READTABLE
SYMBOL)named-readtables: (OR
READTABLE
SYMBOL)result: READTABLE Description:
Copy the contents of each readtable in named-readtables into result-table.
If a macro character appears in more than one of the readtables, i.e. if a conflict is discovered
during the merge, an error of typeis signaled.READER-MACRO-CONFLICT
[Type]
named-readtable-designator
Description:
Either a symbol or a readtable itself.
[Condition type]
reader-macro-conflict
Description:
Continuable.
This condition is signaled during the merge process if a) a reader macro (be it a macro character
or the sub character of a dispatch macro character) is both present in the source as well as the
target readtable, and b) if and only if the two respective reader macro functions differ.
[Condition type]
readtable-does-already-exist
Description:
Continuable.
[Condition type]
readtable-does-not-exist
[Function]
readtable-name named-readtable => result
Argument and Values:
named-readtable: (OR
READTABLE
SYMBOL)result: SYMBOL Description:
Returns the name of the readtable designated by named-readtable, or NIL.
[Function]
register-readtable name readtable => result
Argument and Values:
name: SYMBOLreadtable: READTABLEresult: READTABLE Description:
Associate readtable with name. Returns the readtable.
[Function]
rename-readtable old-name new-name => result
Argument and Values:
old-name: (OR
READTABLE
SYMBOL)new-name: SYMBOLresult: READTABLE Description:
Replaces the associated name of the readtable designated by old-name with new-name.
If a readtable is already registered under new-name, an error of type
is signaled.READTABLE-DOES-ALREADY-EXIST
[Function]
unregister-readtable named-readtable => result
Argument and Values:
named-readtable: (OR
READTABLE
SYMBOL)result: (MEMBER
T
NIL) Description:
Remove the association of named-readtable. Returnsif successfull,TNILotherwise.
This documentation was generated on 2009-11-5 from a Lisp image using some home-brewn,
duct-taped,
evolutionary hacked extension of Edi Weitz'
DOCUMENTATION-TEMPLATE.