advanced-readtable

Common lisp portable symbol macro extension

Introduction

Advanced-readtables is a common lisp extension that portably allows you to extend find-package and find-symbol. Also it introduces def-symbol-readmacro construction, which creates symbol-readmacro in the way as ANSI CL set-macro-character creates character-readmacro.

Only dependency is named-readtables. Advanced-readtable should work on any CL, that supports named-readtables (tested on SBCL/Linux)

License is BSD. The project is based on http://code.google.com/p/def-symbol-readmacro/. Thanks to the author of def-symbol-readmacro for his extraordinary ideas, how to replace FIND-SYMBOL portably according to ANSI standard.

Thanks to Naryl for his help in beta-testing the project.

Documentation

(set-macro-symbol (symbol func)) => sets FUNC to process the SYMBOL.

FUNC will get stream of reader and the symbol (see set-macro-character).

To prevent symbol from processing (for example in set-macro-symbol construction) you should enclose it in bars.

This construction will set 'foo as an alias to 'long-package-name:long-name:

(set-macro-symbol '|FOO|
   (lambda (stream symbol)
      (declare (ignore stream symbol))
      'long-package-name:long-name))
 

Another way to prevent symbol processing is setting advanced-readtable:*disable-symbol-readmacro* to t

To extend find-package you may use advanced-readtable:*package-finders* or per-package accessor advanced-readtable:package-finders. They are lists of functions (lambda (name current-package)) => package-or-nil. The functions are called in order: per-package first, common after until one of them returns not nil.

To extend find-symbol you may use advanced-readtable:*symbol-finders* or per-package accessor advanced-readtable:symbol-finders. The functions in lists should have type (lambda (name package)) => (values symbol status).

To use advanced readtable, call advanced-readtable:activate or advanced-readtable:!. Advanced-readtable is not intended to be in use-package clause. It defines own versions of find-symbol and find-package.

Verbose documentation at github

Mailing Lists

Download

This project has not released any files.

Project members

Roman Klochkov, monk@slavsoft.surgut.ru

CVS

You can browse my SVN repository or download the current development tree via anonymous svn:

svn checkout svn://common-lisp.net/project/advanced-readtable/svn

Valid XHTML 1.0 Strict