/[advanced-readtable]/README.md
ViewVC logotype

Diff of /README.md

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by rklochkov, Sun Dec 23 10:43:24 2012 UTC revision 17 by rklochkov, Sat Jan 26 20:28:43 2013 UTC
# Line 9  Features Line 9  Features
9  - local intern package like in SBCL: package::(symbol1 symbol2) will intern  - local intern package like in SBCL: package::(symbol1 symbol2) will intern
10                                       package::symbol1 and package::symbol2                                       package::symbol1 and package::symbol2
11    
12    To start
13    --------
14    
15    Either use named-readtables and write
16    
17        (in-readtable :advanced)
18    
19    or simply add to advanced-readtable to current readtable
20    
21        (advanced-readtable:!)
22    
23    Hierarchy packages
24    ------------------
25    
26    Advanced-readtable has fully functional built-in support of hierarchy-packages.
27    .name means "subpackage name in current package", ..name -- "subpackage name in above package",
28    ...name -- "subpackage in two-level-up package" and so on.
29    In in-package you may use .. for above package, ... for two level up, and so on.
30    
31        CL-USER> (defpackage .test (:use cl)))
32        #<PACKAGE "COMMON-LISP-USER.TEST">
33        CL-USER> (in-package .test)
34        TEST> (in-package ..)
35        CL-USER> (defpackage .test.a (:use cl))
36        #<PACKAGE "COMMON-LISP-USER.TEST.A">
37        CL-USER> (in-package .test.a)
38        A> '...::car
39        CAR
40        A> (eq '...::car 'cl:car)
41        T
42        A> (in-package ...test)
43        TEST> (in-package ..)
44        CL-USER>
45    
46    
47    API
48    ===
49    
50  _push-import-prefix_ -- enables import prefix on package name  _push-import-prefix_ -- enables import prefix on package name
51  --------------------------------------------  --------------------------------------------
52    
# Line 51  rename LIB version 1 to LIB1 and LIB ver Line 89  rename LIB version 1 to LIB1 and LIB ver
89      (push-local-nickname :lib1 :lib :a)      (push-local-nickname :lib1 :lib :a)
90      (push-local-nickname :lib2 :lib :b)      (push-local-nickname :lib2 :lib :b)
91    
92    This command also adds local subpackage alias. In the previous example a.lib
93    and b.lib will be aliases to lib1 and lib2. If there is a real package with
94    such name, alias will be shadowed, so don't worry too much about it.
95    
96  _push-local-package_ -- sets local-package for a symbol  _push-local-package_ -- sets local-package for a symbol
97  ----------------------------------------------  ----------------------------------------------
98    
# Line 69  For example, this will be error: Line 111  For example, this will be error:
111    
112  , because first for is in ITERATE package, but second -- is not.  , because first for is in ITERATE package, but second -- is not.
113    
114    Be careful: this change is not local to your package.
115    
116  _set-macro-symbol_ - syntax is like set-macro-character,  _set-macro-symbol_ - syntax is like set-macro-character,
117  ------------------  ------------------
118    
119  But FUNC is binded to SYMBOL, not character.  But FUNC is binded to SYMBOL, not character. This symbol will be processed
120    in all cases, where it is not bounded by ||.
121    
122  Now you may make something like  Now you may make something like
123    
124      html:[body [table (as-html sql:[select * from t1])]]      html:[body [table (as-html sql:[select * from t1])]]
# Line 80  Now you may make something like Line 126  Now you may make something like
126  html:[ and sql:[ will have different handlers and you may mix them in  html:[ and sql:[ will have different handlers and you may mix them in
127  one expression.  one expression.
128    
129    Also it allows to make simple symbol-aliases. For example:
130    
131        (set-macro-symbol '|ALIAS| (lambda (stream symbol)
132                                     (declare (ignore stream symbol))
133                                       'advanced-readtables:push-local-package))
134    Now you may do
135    
136        (alias 'iter:iter :iterate)
137    
138    Moreover, you may alias variables from other packages and set them through
139    alias. But be careful: this change is not local to your package.
140    
141    
142  _get-macro-symbol_ - syntax is like get-macro-character,  _get-macro-symbol_ - syntax is like get-macro-character,
143  ------------------  ------------------
144    
# Line 89  Low-level API Line 148  Low-level API
148  -------------  -------------
149    
150  There are five lists:  There are five lists:
151  -  *package-finders* -- global for find-package  -  `*package-finders*` -- global for find-package
152  -  *symbol-finders* -- global for find-symbol  -  `*symbol-finders*` -- global for find-symbol
153  -  (package-finders package) -- per-package for find-package  -  (package-finders package) -- per-package for find-package
154  -  (symbol-finders package) -- per-package for find-symbol  -  (symbol-finders package) -- per-package for find-symbol
155  -  (extra-finders symbol) -- per-symbol for (symbol ....) package substitution  -  (extra-finders symbol) -- per-symbol for (symbol ....) package substitution
# Line 112  To simplify adding new handlers with key Line 171  To simplify adding new handlers with key
171  will set handler for package pack, if there are no hanler with key  will set handler for package pack, if there are no hanler with key
172  (:my handler1). So you may set it in your file and not be afraid, that it  (:my handler1). So you may set it in your file and not be afraid, that it
173  will duplicate on reloading.  will duplicate on reloading.
174    
175    Restrictions
176    ------------
177    
178    You must only ASCII characters for first letter of every part of package name
179    and for first letter of symbols, that you want to use in set-macro-symbol
180    
181    If you really need other characters you may set them by calling
182    
183        (set-macro-character c #'advanced-readtable:read-token-with-colons t)
184    
185    for every your character.
186    
187    If you need to temporary disable macro-characted substitution, you may set
188    `advanced-readtable:*enable-symbol-readmacro*` to nil. It could be useful, if you
189    describe a lot of symbols and don't want to enclose every of them in || (and upcase, of course).

Legend:
Removed from v.9  
changed lines
  Added in v.17

  ViewVC Help
Powered by ViewVC 1.1.5