" VIM Syntax file for txr
" Kaz Kylheku <kaz@kylheku.com>

" INSTALL-HOWTO:
"
" 1. Create the directory .vim/syntax in your home directory and
"    put the files txr.vim and txl.vim into this directory.
" 2. In your .vimrc, add this command to associate *.txr and *.tl
"    files with the txr and txl filetypes:
"    :au BufRead,BufNewFile *.txr set filetype=txr | set lisp
"    :au BufRead,BufNewFile *.tl set filetype=txl | 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 txl_keyword contained * *args* *e* *flo-dig*
syn keyword txl_keyword contained *flo-epsilon* *flo-max* *flo-min* *full-args*
syn keyword txl_keyword contained *gensym-counter* *keyword-package* *pi* *place-clobber-expander*
syn keyword txl_keyword contained *place-delete-expander* *place-update-expander* *random-state* *self-path*
syn keyword txl_keyword contained *stddebug* *stderr* *stdin* *stdlog*
syn keyword txl_keyword contained *stdnull* *stdout* *txr-version* *unhandled-hook*
syn keyword txl_keyword contained *user-package* + - /
syn keyword txl_keyword contained /= < <= =
syn keyword txl_keyword contained > >= abort abs
syn keyword txl_keyword contained abs-path-p acons acons-new aconsql-new
syn keyword txl_keyword contained acos ado alist-nremove alist-remove
syn keyword txl_keyword contained all and andf ap
syn keyword txl_keyword contained apf append append* append-each
syn keyword txl_keyword contained append-each* apply aret ash
syn keyword txl_keyword contained asin assoc assql atan
syn keyword txl_keyword contained atan2 atom bignump bit
syn keyword txl_keyword contained block boundp break-str call
syn keyword txl_keyword contained call-clobber-expander call-delete-expander call-update-expander callf
syn keyword txl_keyword contained car caseq caseql casequal
syn keyword txl_keyword contained cat-str cat-streams cat-vec catch
syn keyword txl_keyword contained catenated-stream-p catenated-stream-push cdr ceil
syn keyword txl_keyword contained chain chand chdir chmod
syn keyword txl_keyword contained chr-isalnum chr-isalpha chr-isascii chr-isblank
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-isunisp
syn keyword txl_keyword contained chr-isupper chr-isxdigit chr-num chr-str
syn keyword txl_keyword contained chr-str-set chr-tolower chr-toupper chrp
syn keyword txl_keyword contained clear-error close-stream closelog cmp-str
syn keyword txl_keyword contained collect-each collect-each* comb compl-span-str
syn keyword txl_keyword contained cond conda cons conses
syn keyword txl_keyword contained conses* consp constantp copy
syn keyword txl_keyword contained copy-alist copy-cons copy-hash copy-list
syn keyword txl_keyword contained copy-str copy-vec cos count-if
syn keyword txl_keyword contained countq countql countqual cum-norm-dist
syn keyword txl_keyword contained daemon dec define-modify-macro defmacro
syn keyword txl_keyword contained defparm defplace defsymacro defun
syn keyword txl_keyword contained defvar del delay delete-package
syn keyword txl_keyword contained do dohash dotimes downcase-str
syn keyword txl_keyword contained dup dupfd dwim each
syn keyword txl_keyword contained each* empty ensure-dir env
syn keyword txl_keyword contained env-fbind env-hash env-vbind eq
syn keyword txl_keyword contained eql equal errno error
syn keyword txl_keyword contained eval evenp exec exit
syn keyword txl_keyword contained exit* exp expt exptmod
syn keyword txl_keyword contained false fbind fboundp fifth
syn keyword txl_keyword contained fileno filter-equal filter-string-tree finalize
syn keyword txl_keyword contained find find-if find-max find-min
syn keyword txl_keyword contained find-package first fixnump flatten
syn keyword txl_keyword contained flatten* flet flip flipargs
syn keyword txl_keyword contained flo-int flo-str floatp floor
syn keyword txl_keyword contained flush-stream fmakunbound for for*
syn keyword txl_keyword contained force fork format fourth
syn keyword txl_keyword contained fun func-get-env func-get-form func-set-env
syn keyword txl_keyword contained functionp gcd gen generate
syn keyword txl_keyword contained gensym gequal get-byte get-char
syn keyword txl_keyword contained get-clobber-expander get-delete-expander get-error get-error-str
syn keyword txl_keyword contained get-hash-userdata get-line get-lines get-list-from-stream
syn keyword txl_keyword contained get-sig-handler get-string get-string-from-stream get-update-expander
syn keyword txl_keyword contained getenv gethash getitimer getpid
syn keyword txl_keyword contained getppid giterate glob glob-altdirfunc
syn keyword txl_keyword contained glob-brace glob-err glob-mark glob-nocheck
syn keyword txl_keyword contained glob-noescape glob-nomagic glob-nosort glob-onlydir
syn keyword txl_keyword contained glob-period glob-tilde glob-tilde-check greater
syn keyword txl_keyword contained group-by gun hash hash-alist
syn keyword txl_keyword contained hash-construct hash-count hash-diff hash-eql
syn keyword txl_keyword contained hash-equal hash-isec hash-keys hash-pairs
syn keyword txl_keyword contained hash-uni hash-update hash-update-1 hash-values
syn keyword txl_keyword contained hashp have html-decode html-encode
syn keyword txl_keyword contained iapply identity ido if
syn keyword txl_keyword contained ifa iff iffi iflet
syn keyword txl_keyword contained ignerr in inc inhash
syn keyword txl_keyword contained int-flo int-str integerp intern
syn keyword txl_keyword contained interp-fun-p interpose ip ipf
syn keyword txl_keyword contained isqrt itimer-prov itimer-real itimer-virtual
syn keyword txl_keyword contained juxt keep-if keep-if* keywordp
syn keyword txl_keyword contained kill labels lambda last
syn keyword txl_keyword contained lazy-str lazy-str-force lazy-str-force-upto lazy-str-get-trailing-list
syn keyword txl_keyword contained lazy-stream-cons lazy-stringp lbind lcm
syn keyword txl_keyword contained lcons lcons-fun lconsp ldiff
syn keyword txl_keyword contained length length-list length-str length-str-<
syn keyword txl_keyword contained length-str-<= length-str-> length-str->= length-vec
syn keyword txl_keyword contained lequal less let let*
syn keyword txl_keyword contained lexical-fun-p lexical-lisp1-binding lexical-var-p link
syn keyword txl_keyword contained lisp-parse list list* list-str
syn keyword txl_keyword contained list-vector listp load log
syn keyword txl_keyword contained log-alert log-auth log-authpriv log-cons
syn keyword txl_keyword contained log-crit log-daemon log-debug log-emerg
syn keyword txl_keyword contained log-err log-info log-ndelay log-notice
syn keyword txl_keyword contained log-nowait log-odelay log-perror log-pid
syn keyword txl_keyword contained log-user log-warning log10 log2
syn keyword txl_keyword contained logand logior lognot logtest
syn keyword txl_keyword contained logtrunc logxor macro-form-p macro-time
syn keyword txl_keyword contained macroexpand macroexpand-1 macrolet major
syn keyword txl_keyword contained make-catenated-stream make-env make-hash make-lazy-cons
syn keyword txl_keyword contained make-like make-package make-random-state make-similar-hash
syn keyword txl_keyword contained make-string-byte-input-stream make-string-input-stream make-string-output-stream make-strlist-output-stream
syn keyword txl_keyword contained make-sym make-time make-time-utc make-trie
syn keyword txl_keyword contained makedev makunbound mapcar mapcar*
syn keyword txl_keyword contained mapdo mapf maphash mappend
syn keyword txl_keyword contained mappend* mask match-fun match-regex
syn keyword txl_keyword contained match-regex-right match-regst match-regst-right match-str
syn keyword txl_keyword contained match-str-tree max member member-if
syn keyword txl_keyword contained memq memql memqual merge
syn keyword txl_keyword contained min minor minusp mkdir
syn keyword txl_keyword contained mknod mkstring mlet mod
syn keyword txl_keyword contained multi multi-sort n-choose-k n-perm-k
syn keyword txl_keyword contained nconc nilf none not
syn keyword txl_keyword contained notf nreverse null nullify
syn keyword txl_keyword contained num-chr num-str numberp oand
syn keyword txl_keyword contained oddp op open-command open-directory
syn keyword txl_keyword contained open-file open-fileno open-files open-files*
syn keyword txl_keyword contained open-pipe open-process open-tail openlog
syn keyword txl_keyword contained opip or orf packagep
syn keyword txl_keyword contained pad partition partition* partition-by
syn keyword txl_keyword contained perm pipe plusp poll
syn keyword txl_keyword contained poll-err poll-in poll-nval poll-out
syn keyword txl_keyword contained poll-pri poll-rdband poll-rdhup poll-wrband
syn keyword txl_keyword contained pop pos pos-if pos-max
syn keyword txl_keyword contained pos-min posq posql posqual
syn keyword txl_keyword contained pppred ppred pprinl pprint
syn keyword txl_keyword contained pprof pred prinl print
syn keyword txl_keyword contained prof prog1 progn prop
syn keyword txl_keyword contained proper-listp pset push pushhash
syn keyword txl_keyword contained pushnew put-byte put-char put-line
syn keyword txl_keyword contained put-lines put-string put-strings pwd
syn keyword txl_keyword contained qquote quasi quasilist quote
syn keyword txl_keyword contained rand random random-fixnum random-state-p
syn keyword txl_keyword contained range range* range-regex rcomb
syn keyword txl_keyword contained read readlink real-time-stream-p reduce-left
syn keyword txl_keyword contained reduce-right ref refset regex-compile
syn keyword txl_keyword contained regex-parse regexp regsub rehome-sym
syn keyword txl_keyword contained remhash remove-if remove-if* remove-path
syn keyword txl_keyword contained remq remq* remql remql*
syn keyword txl_keyword contained remqual remqual* rename-path repeat
syn keyword txl_keyword contained replace replace-list replace-str replace-vec
syn keyword txl_keyword contained rest ret retf return
syn keyword txl_keyword contained return-from reverse rlcp rlet
syn keyword txl_keyword contained rotate rperm rplaca rplacd
syn keyword txl_keyword contained run 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-ifsock s-irgrp s-iroth s-irusr
syn keyword txl_keyword contained s-irwxg s-irwxo s-irwxu s-isgid
syn keyword txl_keyword contained s-isuid s-isvtx s-iwgrp s-iwoth
syn keyword txl_keyword contained s-iwusr s-ixgrp s-ixoth s-ixusr
syn keyword txl_keyword contained search search-regex search-regst search-str
syn keyword txl_keyword contained search-str-tree second seek-stream select
syn keyword txl_keyword contained seqp set set-diff set-hash-userdata
syn keyword txl_keyword contained set-sig-handler setenv sethash setitimer
syn keyword txl_keyword contained setlogmask setq sh shift
syn keyword txl_keyword contained sig-abrt sig-alrm sig-bus sig-check
syn keyword txl_keyword contained sig-chld sig-cont sig-fpe sig-hup
syn keyword txl_keyword contained sig-ill sig-int sig-io sig-iot
syn keyword txl_keyword contained sig-kill sig-lost sig-pipe sig-poll
syn keyword txl_keyword contained sig-prof sig-pwr sig-quit sig-segv
syn keyword txl_keyword contained sig-stkflt sig-stop sig-sys sig-term
syn keyword txl_keyword contained sig-trap sig-tstp sig-ttin sig-ttou
syn keyword txl_keyword contained sig-urg sig-usr1 sig-usr2 sig-vtalrm
syn keyword txl_keyword contained sig-winch sig-xcpu sig-xfsz sign-extend
syn keyword txl_keyword contained sin sixth size-vec some
syn keyword txl_keyword contained sort sort-group source-loc source-loc-str
syn keyword txl_keyword contained span-str splice split-str split-str-set
syn keyword txl_keyword contained sqrt sssucc ssucc stat
syn keyword txl_keyword contained stdlib str< str<= str=
syn keyword txl_keyword contained str> str>= stream-get-prop stream-set-prop
syn keyword txl_keyword contained streamp string-extend string-lt stringp
syn keyword txl_keyword contained sub sub-list sub-str sub-vec
syn keyword txl_keyword contained succ swap symacrolet symbol-function
syn keyword txl_keyword contained symbol-name symbol-package symbol-value symbolp
syn keyword txl_keyword contained symlink sys-qquote sys-splice sys-unquote
syn keyword txl_keyword contained sys:*lisp1* sys:eval-err sys:get-fb sys:get-vb
syn keyword txl_keyword contained sys:l1-setq sys:l1-val sys:sym-clobber-expander sys:sym-delete-expander
syn keyword txl_keyword contained sys:sym-update-expander syslog tan tb
syn keyword txl_keyword contained tc tf third throw
syn keyword txl_keyword contained throwf time time-fields-local time-fields-utc
syn keyword txl_keyword contained time-string-local time-string-utc time-usec tofloat
syn keyword txl_keyword contained toint tok-str tok-where tostring
syn keyword txl_keyword contained tostringp tprint transpose tree-bind
syn keyword txl_keyword contained tree-case tree-find trie-add trie-compress
syn keyword txl_keyword contained trie-lookup-begin trie-lookup-feed-char trie-value-at trim-str
syn keyword txl_keyword contained true trunc trunc-rem tuples
syn keyword txl_keyword contained txr-case txr-if txr-when typeof
syn keyword txl_keyword contained unget-byte unget-char uniq unique
syn keyword txl_keyword contained unless unquote unsetenv until
syn keyword txl_keyword contained until* upcase-str update url-decode
syn keyword txl_keyword contained url-encode usleep uw-protect vec
syn keyword txl_keyword contained vec-push vec-set-length vecref vector
syn keyword txl_keyword contained vector-list vectorp w-continued w-coredump
syn keyword txl_keyword contained w-exitstatus w-ifcontinued w-ifexited w-ifsignaled
syn keyword txl_keyword contained w-ifstopped w-nohang w-stopsig w-termsig
syn keyword txl_keyword contained w-untraced wait weave when
syn keyword txl_keyword contained whenlet where while while*
syn keyword txl_keyword contained whilet width with-clobber-expander with-delete-expander
syn keyword txl_keyword contained with-gensyms with-saved-vars with-update-expander wrap
syn keyword txl_keyword contained wrap* zap zerop zip

syn keyword txr_keyword contained accept all and assert
syn keyword txr_keyword contained bind block cases cat
syn keyword txr_keyword contained catch choose chr close
syn keyword txr_keyword contained coll collect defex deffilter
syn keyword txr_keyword contained define do elif else
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 if
syn keyword txr_keyword contained include last line 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 until var
syn match txr_error "@[\t ]*[*]\?[\t ]*."
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_splicevar "@[ \t,*]*[A-Za-z_][A-Za-z0-9_]*"
syn match txr_regdir "@[ \t]*/\(\\/\|[^/]\|\\\n\)*/"
syn match txr_hashbang "^#!.*"
syn match txr_metanum "@[0-9]\+"
syn match txr_nested_error "[^\t `]\+" contained

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_ncomment ";.*" contained

syn match txr_dot "\." contained
syn match txr_num "#x[+\-]\?[0-9A-Fa-f]\+" contained
syn match txr_num "#o[+\-]\?[0-7]\+" contained
syn match txr_num "#b[+\-]\?[0-1]\+" contained
syn match txr_ident "[A-Za-z0-9!$%&*+\-<=>?\\_~]*[A-Za-z!$#%&*+\-<=>?\\^_~][A-Za-z0-9!$#%&*+\-<=>?\\^_~]*" contained
syn match txl_ident "[:@][A-Za-z0-9!$%&*+\-<=>?\\\^_~/]\+" contained
syn match txr_braced_ident "[:][A-Za-z0-9!$%&*+\-<=>?\\\^_~/]\+" contained
syn match txl_ident "[A-Za-z0-9!$%&*+\-<=>?\\_~/]*[A-Za-z!$#%&*+\-<=>?\\^_~/][A-Za-z0-9!$#%&*+\-<=>?\\^_~/]*" contained
syn match txr_num "[+\-]\?[0-9]\+\([^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]\|\n\)"me=e-1 contained
syn match txr_badnum "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?[A-Za-z!$#%&*+\-<=>?\\^_~/]\+" contained
syn match txr_num "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?\([^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]\|\n\)"me=e-1 contained
syn match txr_num "[+\-]\?[0-9]\+\([eE][+\-]\?[0-9]\+\)\([^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]\|\n\)"me=e-1 contained
syn match txl_ident ":" contained
syn match txl_splice "[ \t,]\|,[*]" contained

syn match txr_unquote "," contained
syn match txr_splice ",\*" contained
syn match txr_quote "'" contained
syn match txr_quote "\^" contained
syn match txr_dotdot "\.\." contained
syn match txr_metaat "@" contained

syn region txr_bracevar matchgroup=Delimiter start="@[ \t]*[*]\?{" matchgroup=Delimiter end="}" contains=txr_num,txr_ident,txr_braced_ident,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_regex,txr_quasilit,txr_chr,txl_splice,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,txr_badnum,txl_ident,txl_regex,txr_string,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,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,txr_badnum,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_metaat,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,txr_badnum,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_metaat,txr_ncomment,txr_nested_error
syn region txr_mlist contained matchgroup=Delimiter start="@[ \t]*(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_metaat,txr_ncomment,txr_nested_error
syn region txr_mbracket matchgroup=Delimiter start="@[ \t]*\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_metaat,txr_ncomment,txr_nested_error
syn region txr_string contained start=+#\?\*\?"+ skip=+\\\\\|\\"\|\\\n+ end=+"\|\n+
syn region txr_quasilit contained start=+#\?\*\?`+ skip=+\\\\\|\\`\|\\\n+ end=+`\|\n+ contains=txr_splicevar,txr_metanum,txr_bracevar,txr_mlist,txr_mbracket
syn region txr_regex contained start="/" skip="\\\\\|\\/\|\\\n" end="/\|\n"
syn region txl_regex contained start="#/" skip="\\\\\|\\/\|\\\n" end="/\|\n"

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_splicevar 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_badnum Error
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_metaat Special
hi def link txr_munqspl Special
hi def link txl_splice Special
hi def link txr_error Error
hi def link txr_nested_error Error

let b:current_syntax = "lisp"