3 " Maintainer: Alex Chapman <chapman.alex@gmail.com>
4 " Last Change: 2006 Mar 23
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 " factor is case sensitive.
17 "is there a better way to make vim treat any non-whitespace char as part of a word?
30 setlocal iskeyword+=\[
31 setlocal iskeyword+=\]
32 setlocal iskeyword+=\/
33 setlocal iskeyword+=\{
34 setlocal iskeyword+=\}
35 setlocal iskeyword+=\.
36 setlocal iskeyword+=\!
37 setlocal iskeyword+=\$
38 setlocal iskeyword+=\^
41 syn cluster factorCluster contains=factorComment,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorColon,factorDefn,factorDefnBody,factorDefnEnd,factorString,@factorNumber
43 " Script headers highlighted like comments
44 syn match factorComment /\<#! .*/ contains=factorTodo
45 syn match factorComment /\<! .*/ contains=factorTodo
46 syn keyword factorTodo TODO FIXME XXX contained
48 syn keyword factorBoolean boolean f general-t t
50 " use this to have keywords as all words from all vocabs (currently broken by | characters)
53 " use this to only have keywords highlighted from the kernel vocab
54 syn keyword factorKeyword continuation-name set-datastack <empty-continuation> wrapper set-continuation-name continuation-catch slip pick 2slip tuple 2nip set-boot clone with-datastack cpu cli-bool-param default-cli-args tuck -rot set-continuation-retain swapd <continuation> >boolean wrapper? ifcc dupd dup 3dup callstack windows? os-env over = <wrapper> ? 2dup alist>quot continuation cond win64? <quotation> continue run-user-init 3drop xor quotation when hashcode curry cli-param default-shell millis set-callstack unless >r version die callcc0 or os callcc1 ignore-cli-args? depth 3keep no-cond? cli-var-param continue-with if exit tuple? unix? set-retainstack cli-args general-t continuation? <no-cond> parse-command-line macosx? r> rot win32? retainstack 2apply >quotation >continuation< type continuation-call clear no-cond call continuation-data 2drop set-continuation-call drop unit set-continuation-data keep-datastack and when* cli-arg quotation? ?if 2swap literalize swap set-continuation-catch datastack unless* not eq? continuation-retain with make-dip wrapped keep 2keep <=> nip if*
57 syn cluster factorNumber contains=factorInt,factorFloat,factorRatio,factorComplex
58 syn cluster factorReal contains=factorInt,factorFloat,factorRatio
59 syn match factorInt /\<-\=\d\+\>/
60 syn match factorFloat /\<-\=\d*\.\d\+\>/
61 syn match factorRatio /\<-\=\d*\.*\d\+\/-\=\d*\.*\d\+\>/
62 syn region factorComplex start=/\<C{\>/ end=/\<}\>/ contains=@factorReal,factorComplexErr
64 "syn region factorColon matchgroup=Keyword start=/\<:\s\+\S\+\>/ matchgroup=Keyword end=/\<;\>/ contains=ALL
66 syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
67 syn region factorComment start=/\<(\>/ end=/\<)\>/
69 syn region factorCons matchgroup=Delimiter start=/\<\[\[\>/ matchgroup=Delimiter end=/\<\]\]\>/ contains=ALL
70 syn region factorVector matchgroup=Delimiter start=/\<V{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
71 syn region factorHash matchgroup=Delimiter start=/\<H{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
72 syn region factorTuple matchgroup=Delimiter start=/\<T{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
73 syn region factorWrapper matchgroup=Delimiter start=/\<W{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
75 "adapted from lisp.vim
76 if exists("g:factor_norainbow")
77 syn region factorQuotation matchgroup=Delimiter start=/\<\[\>/ matchgroup=Delimiter end=/\<\]\>/ contains=ALL
79 syn region factorQuotation0 matchgroup=hlLevel0 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1
80 syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2
81 syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3
82 syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4
83 syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5
84 syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6
85 syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7
86 syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8
87 syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9
88 syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0
91 if exists("g:factor_norainbow")
92 syn region factorArray matchgroup=Delimiter start=/\<{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
94 syn region factorArray0 matchgroup=hlLevel0 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray1
95 syn region factorArray1 contained matchgroup=hlLevel1 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray2
96 syn region factorArray2 contained matchgroup=hlLevel2 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray3
97 syn region factorArray3 contained matchgroup=hlLevel3 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray4
98 syn region factorArray4 contained matchgroup=hlLevel4 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray5
99 syn region factorArray5 contained matchgroup=hlLevel5 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray6
100 syn region factorArray6 contained matchgroup=hlLevel6 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray7
101 syn region factorArray7 contained matchgroup=hlLevel7 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray8
102 syn region factorArray8 contained matchgroup=hlLevel8 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray9
103 syn region factorArray9 contained matchgroup=hlLevel9 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray0
106 syn match factorQuotationError /\<\]\>/
110 if version >= 508 || !exists("did_factor_syn_inits")
112 let did_factor_syn_inits = 1
113 command -nargs=+ HiLink hi link <args>
115 command -nargs=+ HiLink hi def link <args>
118 HiLink factorComment Comment
119 HiLink factorTodo Todo
120 HiLink factorInclude Include
121 HiLink factorRepeat Repeat
122 HiLink factorConditional Conditional
123 HiLink factorKeyword Keyword
124 HiLink factorOperator Operator
125 HiLink factorBoolean Boolean
126 " HiLink factorColon Typedef
127 HiLink factorDefn Function
128 HiLink factorDefnEnd Typedef
129 HiLink factorString String
130 HiLink factorQuotationError Error
131 HiLink factorInt Number
132 HiLink factorFloat Float
133 HiLink factorRatio Number
134 HiLink factorComplex Number
135 HiLink factorComplexErr Error
138 hi hlLevel0 ctermfg=red guifg=red1
139 hi hlLevel1 ctermfg=yellow guifg=orange1
140 hi hlLevel2 ctermfg=green guifg=yellow1
141 hi hlLevel3 ctermfg=cyan guifg=greenyellow
142 hi hlLevel4 ctermfg=magenta guifg=green1
143 hi hlLevel5 ctermfg=red guifg=springgreen1
144 hi hlLevel6 ctermfg=yellow guifg=cyan1
145 hi hlLevel7 ctermfg=green guifg=slateblue1
146 hi hlLevel8 ctermfg=cyan guifg=magenta1
147 hi hlLevel9 ctermfg=magenta guifg=purple1
149 hi hlLevel0 ctermfg=red guifg=red3
150 hi hlLevel1 ctermfg=darkyellow guifg=orangered3
151 hi hlLevel2 ctermfg=darkgreen guifg=orange2
152 hi hlLevel3 ctermfg=blue guifg=yellow3
153 hi hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
154 hi hlLevel5 ctermfg=red guifg=green4
155 hi hlLevel6 ctermfg=darkyellow guifg=paleturquoise3
156 hi hlLevel7 ctermfg=darkgreen guifg=deepskyblue4
157 hi hlLevel8 ctermfg=blue guifg=darkslateblue
158 hi hlLevel9 ctermfg=darkmagenta guifg=darkviolet
164 let b:current_syntax = "factor"