summaryrefslogtreecommitdiffstats
path: root/txr.vim
blob: 4771aa38154b1dab4c364daedfdaf18e2c3275c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
" 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 accept all and bind
syn keyword txr_keyword contained block cases cat catch
syn keyword txr_keyword contained choose close coll collect
syn keyword txr_keyword contained defex deffilter define do
syn keyword txr_keyword contained end eof eol fail
syn keyword txr_keyword contained filter finally flatten forget
syn keyword txr_keyword contained freeform fuzz gather load
syn keyword txr_keyword contained local maybe merge next
syn keyword txr_keyword contained none or output rebind
syn keyword txr_keyword contained rep repeat require set
syn keyword txr_keyword contained skip some text throw
syn keyword txr_keyword contained trailer try var

syn keyword txl_keyword contained * *keyword-package* *random-state* *self-path*
syn keyword txl_keyword contained *stddebug* *stderr* *stdin* *stdout*
syn keyword txl_keyword contained *system-package* *user-package* + -
syn keyword txl_keyword contained / /= < <=
syn keyword txl_keyword contained = > >= abs
syn keyword txl_keyword contained acons acons-new aconsql-new acos
syn keyword txl_keyword contained alist-nremove alist-remove all and
syn keyword txl_keyword contained andf append append* apply
syn keyword txl_keyword contained ash asin assoc assql
syn keyword txl_keyword contained atan atom bignump block
syn keyword txl_keyword contained break-str call car cat-str
syn keyword txl_keyword contained cat-vec catch cdr ceil
syn keyword txl_keyword contained chain chr-isalnum chr-isalpha chr-isascii
syn keyword txl_keyword contained chr-iscntrl chr-isdigit chr-isgraph chr-islower
syn keyword txl_keyword contained chr-isprint chr-ispunct chr-isspace chr-isupper
syn keyword txl_keyword contained chr-isxdigit chr-num chr-str chr-str-set
syn keyword txl_keyword contained chr-tolower chr-toupper chrp close-stream
syn keyword txl_keyword contained collect-each collect-each* compl-span-str cond
syn keyword txl_keyword contained cons consp copy-alist copy-cons
syn keyword txl_keyword contained copy-hash copy-list copy-str copy-vec
syn keyword txl_keyword contained cos count-if countq countql
syn keyword txl_keyword contained countqual daemon dec defun
syn keyword txl_keyword contained defvar del delete-package dohash
syn keyword txl_keyword contained downcase-str dwim each each*
syn keyword txl_keyword contained eq eql equal errno
syn keyword txl_keyword contained error eval evenp exp
syn keyword txl_keyword contained expt exptmod fifth find
syn keyword txl_keyword contained find-if find-package first fixnump
syn keyword txl_keyword contained flatten flatten* flip flo-int
syn keyword txl_keyword contained flo-str floatp floor flush-stream
syn keyword txl_keyword contained for for* force format
syn keyword txl_keyword contained fourth fun func-get-env func-get-form
syn keyword txl_keyword contained functionp gcd generate gensym
syn keyword txl_keyword contained get-byte get-char get-hash-userdata get-line
syn keyword txl_keyword contained get-list-from-stream get-string-from-stream gethash hash
syn keyword txl_keyword contained hash-alist hash-construct hash-count hash-diff
syn keyword txl_keyword contained hash-eql hash-equal hash-isec hash-keys
syn keyword txl_keyword contained hash-pairs hash-uni hash-values hashp
syn keyword txl_keyword contained identity if iff iffi
syn keyword txl_keyword contained inc int-flo int-str integerp
syn keyword txl_keyword contained intern interp-fun-p isqrt keep-if
syn keyword txl_keyword contained keep-if* keywordp lambda lazy-str
syn keyword txl_keyword contained lazy-str-force lazy-str-force-upto lazy-str-get-trailing-list lazy-stream-cons
syn keyword txl_keyword contained lazy-stringp lcons-fun ldiff length
syn keyword txl_keyword contained length-list length-str length-str-< length-str-<=
syn keyword txl_keyword contained length-str-> length-str->= length-vec let
syn keyword txl_keyword contained let* list list-str list-vector
syn keyword txl_keyword contained listp log logand logior
syn keyword txl_keyword contained lognot logtest logtrunc logxor
syn keyword txl_keyword contained make-hash make-lazy-cons make-package make-random-state
syn keyword txl_keyword contained make-similar-hash make-string-byte-input-stream make-string-input-stream make-string-output-stream
syn keyword txl_keyword contained make-strlist-output-stream make-sym make-time make-time-utc
syn keyword txl_keyword contained mapcar mapcar* maphash mappend
syn keyword txl_keyword contained mappend* match-fun match-regex match-str
syn keyword txl_keyword contained match-str-tree max memq memql
syn keyword txl_keyword contained memqual merge min mkstring
syn keyword txl_keyword contained mod multi-sort none not
syn keyword txl_keyword contained nreverse null num-chr num-str
syn keyword txl_keyword contained numberp oddp open-command open-directory
syn keyword txl_keyword contained open-file open-pipe open-process open-tail
syn keyword txl_keyword contained or orf packagep pop
syn keyword txl_keyword contained pprint print prog1 progn
syn keyword txl_keyword contained prop proper-listp push pushhash
syn keyword txl_keyword contained put-byte put-char put-line put-string
syn keyword txl_keyword contained qquote quasi quote rand
syn keyword txl_keyword contained random random-fixnum random-state-p range
syn keyword txl_keyword contained range* reduce-left reduce-right ref
syn keyword txl_keyword contained refset regex-compile regexp regsub
syn keyword txl_keyword contained rehome-sym remhash remove-if remove-if*
syn keyword txl_keyword contained remq remq* remql remql*
syn keyword txl_keyword contained remqual remqual* repeat replace
syn keyword txl_keyword contained replace-list replace-str replace-vec rest
syn keyword txl_keyword contained return return-from reverse rplaca
syn keyword txl_keyword contained rplacd s-ifblk s-ifchr s-ifdir
syn keyword txl_keyword contained s-ififo s-iflnk s-ifmt s-ifreg
syn keyword txl_keyword contained s-irgrp s-iroth s-irusr s-irwxg
syn keyword txl_keyword contained s-irwxo s-irwxu s-isgid s-isuid
syn keyword txl_keyword contained s-isvtx s-iwgrp s-iwoth s-iwusr
syn keyword txl_keyword contained s-ixgrp s-ixoth s-ixusr search-regex
syn keyword txl_keyword contained search-str search-str-tree second seek-stream
syn keyword txl_keyword contained set set-diff set-hash-userdata sethash
syn keyword txl_keyword contained sin sixth size-vec some
syn keyword txl_keyword contained sort source-loc source-loc-str span-str
syn keyword txl_keyword contained splice split-str split-str-set sqrt
syn keyword txl_keyword contained stat string-cmp string-extend string-lt
syn keyword txl_keyword contained stringp sub sub-list sub-str
syn keyword txl_keyword contained sub-vec symbol-function symbol-name symbol-package
syn keyword txl_keyword contained symbolp tan third throw
syn keyword txl_keyword contained throwf time time-string-local time-string-utc
syn keyword txl_keyword contained time-usec tok-str tostring tostringp
syn keyword txl_keyword contained tree-find trim-str trunc typeof
syn keyword txl_keyword contained unquote upcase-str url-decode url-encode
syn keyword txl_keyword contained uw-protect vec-push vec-set-length vecref
syn keyword txl_keyword contained vector vector-list vectorp zerop

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_num "#x[+-]\?[0-9A-Fa-f]\+" 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"