summaryrefslogtreecommitdiffstats
path: root/genvim.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-10 07:08:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-10 07:08:07 -0700
commitcbf8c45bc7e737a849b62d4c2283aae11a3010e1 (patch)
tree80327ad951250d5966c4480b8fbb38baa8e5129e /genvim.txr
parente046e1890f4655478a99fa7c1cb078eefdc54e00 (diff)
downloadtxr-cbf8c45bc7e737a849b62d4c2283aae11a3010e1.tar.gz
txr-cbf8c45bc7e737a849b62d4c2283aae11a3010e1.tar.bz2
txr-cbf8c45bc7e737a849b62d4c2283aae11a3010e1.zip
Don't scan C source code for Lisp symbols.
* eval.c (eval_init): Register package-alist, package-name and package-symbols intrinsics. * genvim.txr: Rather than scanning C sources for TXR Lisp symbols, iterate over the packages and their symbols, collecting anything which has a binding or is self-evaluating. To get the stdlib symbols, we trigger the autoloads by doing boundp queries on a few symbols. * txr.1: Document package-alist, package-name and package-symbols.
Diffstat (limited to 'genvim.txr')
-rw-r--r--genvim.txr50
1 files changed, 17 insertions, 33 deletions
diff --git a/genvim.txr b/genvim.txr
index 9fbe15cd..40901d76 100644
--- a/genvim.txr
+++ b/genvim.txr
@@ -7,43 +7,27 @@ static void dir_tables_init(void)
@(until)
}
@(end)
-@(bind lib "share/txr/stdlib")
-@(next @(open-files ^(#*"eval.c rand.c signal.c stream.c gc.c glob.c"
- #*"syslog.c filter.c txr.c arith.c unwind.c cadr.c"
- ,*#`sysif.c struct.c @lib/place.tl @lib/ifa.tl`
- ,*#`@lib/ver.tl @lib/cadr.tl @lib/with-resources.tl`
- ,*#`@lib/txr-case.tl @lib/path-test.tl @lib/struct.tl`)))
-@(collect)
-@ (block)
-@ (cases)
-@/.*system_package.*/
-@ (accept)
-@ (or)
- reg_@/op|mac/(@{txl-sym-nostar}_star_s,@(skip)
-@ (bind txl-sym `@{txl-sym-nostar}*`)
-@ (or)
- reg_@/op|mac/(@{txl-sym}_s,@(skip)
-@ (or)
- reg_@/op|mac|fun/(@(skip)intern(lit("@{txl-sym}")@(skip)
-@ (or)
- reg_fun(@{txl-sym}_s,@(skip)
-@ (or)
- reg_var@/l?/(@{txl-sym-special}_s,@(skip)
-@ (bind txl-sym `*@{txl-sym-special}*`)
-@ (or)
- @/ *reg_varl?/(@(skip)intern(lit("@{txl-sym}")@(skip)
-@ (or)
-@/ *\((defun|defvarl?|defmacro)/ @{txl-sym} @(skip)
-@ (end)
-@ (set txl-sym @(regsub #/_/ #\- txl-sym))
-@ (end)
-@(end)
+@(do (each ((s '(*place-clobber-expander* *lib-version*
+ ifa txr-if with-resources path-exists-p
+ defstruct)))
+ (boundp s)))
+@(bind txl-sym
+ @(append-each* ((entry (package-alist))
+ (pkg-name [mapcar car entry])
+ (pkg [mapcar cdr entry]))
+ (append-each ((sym (package-symbols pkg)))
+ (when (or (boundp sym) (fboundp sym) (constantp sym))
+ (let ((qualif (casequal pkg-name
+ ("keyword" ":")
+ ("usr" "")
+ (t `@{pkg-name}:`))))
+ (list `@qualif@(symbol-name sym)`))))))
@(do (set [txr-sym 0..0] '("rep" "end" "and" "or"
"catch" "finally"
"until" "last"
"if" "else" "elif"
"include")))
-@(do (set [txl-sym 0..0] '("macro-time" "macrolet" "symacrolet")))
+@(do (set [txl-sym 0..0] '("macro-time")))
@(set (txr-sym txl-sym) (@(sort (uniq txr-sym)) @(sort (uniq txl-sym))))
@(bind bs "\\\\")
@(bind hex "0-9A-Fa-f")
@@ -76,7 +60,7 @@ static void dir_tables_init(void)
syn case match
syn spell toplevel
-setlocal iskeyword=a-z,A-Z,48-57,!,$,&,*,+,-,<,=,>,?,\\,_,~,/
+setlocal iskeyword=a-z,A-Z,48-57,!,$,&,*,+,-,:,<,=,>,?,\\,_,~,/
@ (rep) @{txl-sym}@(mod 0 4)@\nsyn keyword txl_keyword contained @{txl-sym}@(end)
@ (end)
@ (if txr-p)