summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2013-10-23 13:19:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2013-10-23 13:23:20 -0700
commit495d8ca33d3473c9b8e8dc3e3b86dd26b24f5286 (patch)
treebb906bb8561c4e2b086428f588f4f53db33662ce
parent35a59e48c51b9bf1b5551a0c8b96e2756361b7d5 (diff)
downloadtxr-495d8ca33d3473c9b8e8dc3e3b86dd26b24f5286.tar.gz
txr-495d8ca33d3473c9b8e8dc3e3b86dd26b24f5286.tar.bz2
txr-495d8ca33d3473c9b8e8dc3e3b86dd26b24f5286.zip
* genvim.txr: New file.
-rw-r--r--ChangeLog4
-rw-r--r--genvim.txr135
2 files changed, 139 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f8894960..2cd69e9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-10-23 Kaz Kylheku <kaz@kylheku.com>
+ * genvim.txr: New file.
+
+2013-10-23 Kaz Kylheku <kaz@kylheku.com>
+
* configure: Change to header block comment generated in config.h
2013-10-23 Kaz Kylheku <kaz@kylheku.com>
diff --git a/genvim.txr b/genvim.txr
new file mode 100644
index 00000000..246050ba
--- /dev/null
+++ b/genvim.txr
@@ -0,0 +1,135 @@
+@(next "match.c")
+@(skip)
+static void dir_tables_init(void)
+{
+@(collect)
+ sethash(@nil, @{txr-sym}_s,@(skip)
+@(until)
+}
+@(end)
+@(next "eval.c")
+@(skip)
+void eval_init(void)
+{
+@(collect)
+@ (cases)
+ sethash(op_table, @{txl-sym}_s,@(skip)
+@ (or)
+ reg_fun(intern(lit("@{txl-sym}"),@(skip)
+@ (or)
+ reg_fun(@{txl-sym}_s,@(skip)
+@ (or)
+ reg_var(intern(lit("@{txl-sym}"),@(skip)
+@ (end)
+@(until)
+}
+@(end)
+@(do
+ (defun sortuniq (list)
+ (let* ((hash (hash :equal-based)))
+ (mapcar (op sethash hash @1 @1) list)
+ [sort (hash-values hash) string-lt])))
+@(set (txr-sym txl-sym) (@(sortuniq txr-sym) @(sortuniq txl-sym)))
+@(output)
+" VIM Syntax file for txr
+" Kaz Kylheku <kaz@@kylheku.com>
+
+" INSTALL-HOWTO:
+"
+" 1. Create the directory .vim/syntax in your home directory and
+" put this file there.
+" 2. In your .vimrc, add this command to associate *.txr files
+" with the txr filetype.
+" :au BufRead,BufNewFile *.txr set filetype=txr | set lisp
+"
+" If you want syntax highlighting to be on automatically (for any language)
+" you need to add ":syntax on" in your .vimrc also. But you knew that already!
+"
+" This file is generated by the genvim.txr script in the TXR source tree.
+
+syn case match
+syn spell toplevel
+
+setlocal iskeyword=a-z,A-Z,48-57,!,$,&,*,+,-,<,=,>,?,\\,_,~,^
+
+syn keyword txr_keyword contained@(rep) @{txr-sym}@(end)
+syn keyword txl_keyword contained@(rep) @{txl-sym}@(end)
+
+syn match txr_error "@@[\t ]*[*]\?[\t ]*."
+syn match txr_nested_error "[^\t `]\+" contained
+syn match txr_hashbang "^#!.*"
+syn match txr_atat "@@[ \t]*@@"
+syn match txr_comment "@@[ \t]*[#;].*"
+syn match txr_contin "@@[ \t]*\\$"
+syn match txr_char "@@[ \t]*\\."
+syn match txr_char "@@[ \t]*\\x[0-9A-Fa-f]\+"
+syn match txr_char "@@[ \t]*\\[0-9]\+"
+syn match txr_variable "@@[ \t]*[*]\?[ \t]*[A-Za-z_][A-Za-z0-9_]*"
+syn match txr_metanum "@@[0-9]\+"
+syn match txr_regdir "@@[ \t]*/\(\\/\|[^/]\|\\\n\)*/"
+
+syn match txr_chr "#\\x[A-Fa-f0-9]\+" contained
+syn match txr_chr "#\\o[0-9]\+" contained
+syn match txr_chr "#\\[^ \t\nA-Za-z0-9_]" contained
+syn match txr_chr "#\\[A-Za-z0-9_]\+" contained
+syn match txr_regex "/\(\\/\|[^/]\|\\\n\)*/" contained
+syn match txl_regex "#/\(\\/\|[^/]\|\\\n\)*/" contained
+syn match txr_ncomment ";.*" contained
+
+syn match txr_ident "[:@@]\?[A-Za-z0-9!$%&*+\-<=>?\\^_~]\+" contained
+syn match txl_ident "[:@@]\?[A-Za-z0-9!$%&*+\-<=>?\\^_~/]\+" contained
+syn match txl_ident ":" contained
+syn match txr_num "[+-]\?[0-9]\+" contained
+
+syn match txr_unquote "," contained
+syn match txr_splice ",\*" contained
+syn match txr_quote "'" contained
+syn match txr_dot "\." contained
+syn match txr_dotdot "\.\." contained
+
+syn region txr_bracevar matchgroup=Delimiter start="@@[ \t]*[*]\?{" matchgroup=Delimiter end="}" contains=txr_num,txr_ident,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_regex,txr_quasilit,txr_chr,txr_nested_error
+
+syn region txr_directive matchgroup=Delimiter start="@@[ \t]*(" matchgroup=Delimiter end=")" contains=txr_keyword,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_num,txl_ident,txl_regex,txr_string,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_ncomment,txr_nested_error
+
+syn region txr_list contained matchgroup=Delimiter start="#\?H\?(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txl_ident,txr_metanum,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_ncomment,txr_nested_error
+
+syn region txr_bracket contained matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txl_ident,txr_metanum,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_ncomment,txr_nested_error
+
+syn region txr_mlist contained matchgroup=Delimiter start="@@(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txl_ident,txr_metanum,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_ncomment,txr_nested_error
+
+syn region txr_mbracket matchgroup=Delimiter start="@@\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txl_ident,txr_metanum,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_ncomment,txr_nested_error
+
+syn region txr_string contained oneline start=+"+ skip=+\\\\\|\\"+ end=+"+
+syn region txr_quasilit contained oneline start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=txr_variable,txr_metanum,txr_bracevar,txr_mlist,txr_mbracket
+
+hi def link txr_at Special
+hi def link txr_atstar Special
+hi def link txr_atat Special
+hi def link txr_comment Comment
+hi def link txr_ncomment Comment
+hi def link txr_hashbang Preproc
+hi def link txr_contin Preproc
+hi def link txr_char String
+hi def link txr_keyword Keyword
+hi def link txl_keyword Type
+hi def link txr_string String
+hi def link txr_chr String
+hi def link txr_quasilit String
+hi def link txr_regex String
+hi def link txl_regex String
+hi def link txr_regdir String
+hi def link txr_variable Identifier
+hi def link txr_metanum Identifier
+hi def link txr_ident Identifier
+hi def link txl_ident Identifier
+hi def link txr_num Number
+hi def link txr_quote Special
+hi def link txr_unquote Special
+hi def link txr_splice Special
+hi def link txr_dot Special
+hi def link txr_dotdot Special
+hi def link txr_error Error
+hi def link txr_nested_error Error
+
+let b:current_syntax = "lisp"
+@(end)