Help lint: check for empty description elements
[factor/jcg.git] / misc / factor.vim.fgen
blobb0d61b8dd0c8cfdc61eb5ecc4dd87f0ac3799638
1 <% USING: kernel io prettyprint vocabs sequences ;
2 %>" Vim syntax file
3 " Language:     factor
4 " Maintainer:   Alex Chapman <chapman.alex@gmail.com>
5 " Last Change:  2008 Apr 28
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
9 if version < 600
10   syntax clear
11 elseif exists("b:current_syntax")
12   finish
13 endif
15 " factor is case sensitive.
16 syn case match
18 " make all of these characters part of a word (useful for skipping over words with w, e, and b)
19 if version >= 600
20     setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
21 else
22     set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
23 endif
25 syn cluster factorCluster contains=factorComment,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorCompileDirective,factorString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorCharErr,factorBackslash,@factorWordOps,factorAlien,factorTuple
27 syn match factorTodo /\(TODO\|FIXME\|XXX\):\=/ contained
28 syn match factorComment /\<#! .*/ contains=factorTodo
29 syn match factorComment /\<! .*/ contains=factorTodo
31 syn cluster factorDefnContents contains=@factorCluster,factorStackEffect,factorArray0,factorQuotation0
33 syn region factorDefn matchgroup=factorDefnDelims start=/\<\(MACRO\|MEMO\|:\)\?:\s\+\S\+\>/ end=/\<;\>/ contains=@factorDefnContents
34 syn region factorMethod matchgroup=factorMethodDelims start=/\<M:\s\+\S\+\s\+\S\+\>/ end=/\<;\>/ contains=@factorDefnContents
35 syn region factorGeneric matchgroup=factorGenericDelims start=/\<GENERIC:\s\+\S\+\>/ end=/$/ contains=factorStackEffect
36 syn region factorGenericN matchgroup=factorGenericNDelims start=/\<GENERIC#\s\+\S\+\s\+\d\+\>/ end=/$/ contains=factorStackEffect
38 syn region factorPrivateDefn matchgroup=factorPrivateDefnDelims start=/\<\(MACRO\|MEMO\|:\)\?:\s\+\S\+\>/ end=/\<;\>/ contains=@factorDefnContents contained
39 syn region factorPrivateMethod matchgroup=factorPrivateMethodDelims start=/\<M:\s\+\S\+\s\+\S\+\>/ end=/\<;\>/ contains=@factorDefnContents contained
40 syn region factorPGeneric matchgroup=factorPGenericDelims start=/\<GENERIC:\s\+\S\+\>/ end=/$/ contains=factorStackEffect contained
41 syn region factorPGenericN matchgroup=factorPGenericNDelims start=/\<GENERIC#\s\+\S\+\s\+\d\+\>/ end=/$/ contains=factorStackEffect
43 syn region None matchgroup=factorPrivate start=/\<<PRIVATE\>/ end=/\<PRIVATE>\>/ contains=@factorDefnContents,factorPrivateDefn,factorPrivateMethod,factorPGeneric,factorPGenericN
46 syn keyword factorBoolean boolean f general-t t
47 syn keyword factorCompileDirective inline foldable parsing
50 ! uncomment this if you want all words from all vocabularies highlighted. Note
51 ! that this changes factor.vim from around 8k to around 100k (and is a bit
52 ! broken)
54 ! vocabs [ words [ "syn keyword factorKeyword " write [ pprint " " write ] each "\n" write ] when* ] each
57 " kernel vocab keywords
58 <% { "kernel" "assocs" "combinators" "math" "sequences" "namespaces" "arrays" "io" "strings" "vectors" "continuations" } [
59        words "syn keyword factorKeyword " write [ pprint " " write ] each "\n" write
60    ] each %>
62 syn cluster factorReal   contains=factorInt,factorFloat,factorRatio,factorBinary,factorHex,factorOctal
63 syn cluster factorNumber contains=@factorReal,factorComplex
64 syn cluster factorNumErr contains=factorBinErr,factorHexErr,factorOctErr
65 syn match   factorInt           /\<-\=\d\+\>/
66 syn match   factorFloat         /\<-\=\d*\.\d\+\>/
67 syn match   factorRatio         /\<-\=\d*\.*\d\+\/-\=\d*\.*\d\+\>/
68 syn region  factorComplex       start=/\<C{\>/ end=/\<}\>/ contains=@factorReal
69 syn match   factorBinErr        /\<BIN:\s\+[01]*[^\s01]\S*\>/
70 syn match   factorBinary        /\<BIN:\s\+[01]\+\>/
71 syn match   factorHexErr        /\<HEX:\s\+\x*[^\x\s]\S*\>/
72 syn match   factorHex           /\<HEX:\s\+\x\+\>/
73 syn match   factorOctErr        /\<OCT:\s\+\o*[^\o\s]\S*\>/
74 syn match   factorOctal         /\<OCT:\s\+\o\+\>/
76 syn match factorIn /\<IN:\s\+\S\+\>/
77 syn match factorUse /\<USE:\s\+\S\+\>/
79 syn match factorCharErr /\<CHAR:\s\+\S\+/
80 syn match factorChar /\<CHAR:\s\+\\\=\S\>/
82 syn match factorBackslash /\<\\\>\s\+\S\+\>/
84 syn region factorUsing start=/\<USING:\>/ end=/;/
85 syn region factorRequires start=/\<REQUIRES:\>/ end=/;/
87 syn cluster factorWordOps contains=factorSymbol,factorPostpone,factorDefer,factorForget,factorMixin,factorInstance,factorHook,factorMain,factorConstructor
88 syn match factorSymbol /\<SYMBOL:\s\+\S\+\>/
89 syn match factorPostpone /\<POSTPONE:\s\+\S\+\>/
90 syn match factorDefer /\<DEFER:\s\+\S\+\>/
91 syn match factorForget /\<FORGET:\s\+\S\+\>/
92 syn match factorMixin /\<MIXIN:\s\+\S\+\>/
93 syn match factorInstance /\<INSTANCE:\s\+\S\+\s\+\S\+\>/
94 syn match factorHook /\<HOOK:\s\+\S\+\s\+\S\+\>/
95 syn match factorMain /\<MAIN:\s\+\S\+\>/
96 syn match factorConstructor /\<C:\s\+\S\+\s\+\S\+\>/
98 syn match factorAlien /\<ALIEN:\s\+\d\+\>/
100 syn region factorTuple start=/\<TUPLE:\>/ end=/\<;\>/
102 "TODO:
103 "misc:
104 " HELP:
105 " ARTICLE:
106 "literals:
107 " PRIMITIVE:
109 "C interface:
110 " FIELD:
111 " BEGIN-STRUCT:
112 " C-ENUM:
113 " FUNCTION:
114 " END-STRUCT
115 " DLL"
116 " TYPEDEF:
117 " LIBRARY:
118 " C-UNION:
120 syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
121 syn region factorSbuf start=/SBUF" / skip=/\\"/ end=/"/ oneline
123 syn region factorMultiString matchgroup=factorMultiStringDelims start=/\<STRING:\s\+\S\+\>/ end=/^;$/ contains=factorMultiStringContents
124 syn match factorMultiStringContents /.*/ contained
126 "syn match factorStackEffectErr /\<)\>/
127 "syn region factorStackEffectErr start=/\<(\>/ end=/\<)\>/
128 syn region factorStackEffect start=/\<(\>/ end=/\<)\>/ contained
130 "adapted from lisp.vim
131 if exists("g:factor_norainbow") 
132     syn region factorQuotation matchgroup=factorDelimiter start=/\<\[\>/ matchgroup=factorDelimiter end=/\<\]\>/ contains=ALL
133 else
134     syn region factorQuotation0           matchgroup=hlLevel0 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1,factorArray1
135     syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2,factorArray2
136     syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3,factorArray3
137     syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4,factorArray4
138     syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5,factorArray5
139     syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6,factorArray6
140     syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7,factorArray7
141     syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8,factorArray8
142     syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9,factorArray9
143     syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0,factorArray0
144 endif
146 if exists("g:factor_norainbow") 
147     syn region factorArray    matchgroup=factorDelimiter start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/  matchgroup=factorDelimiter end=/\<}\>/ contains=ALL
148 else
149     syn region factorArray0           matchgroup=hlLevel0 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray1,factorQuotation1
150     syn region factorArray1 contained matchgroup=hlLevel1 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray2,factorQuotation2
151     syn region factorArray2 contained matchgroup=hlLevel2 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray3,factorQuotation3
152     syn region factorArray3 contained matchgroup=hlLevel3 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray4,factorQuotation4
153     syn region factorArray4 contained matchgroup=hlLevel4 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray5,factorQuotation5
154     syn region factorArray5 contained matchgroup=hlLevel5 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray6,factorQuotation6
155     syn region factorArray6 contained matchgroup=hlLevel6 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray7,factorQuotation7
156     syn region factorArray7 contained matchgroup=hlLevel7 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray8,factorQuotation8
157     syn region factorArray8 contained matchgroup=hlLevel8 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray9,factorQuotation9
158     syn region factorArray9 contained matchgroup=hlLevel9 start=/\<\(V\|H\|T\|W\|F\|B\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray0,factorQuotation0
159 endif
161 syn match factorBracketErr /\<\]\>/
162 syn match factorBracketErr /\<}\>/
164 syn sync lines=100
166 if version >= 508 || !exists("did_factor_syn_inits")
167     if version <= 508
168         let did_factor_syn_inits = 1
169         command -nargs=+ HiLink hi link <args>
170     else
171         command -nargs=+ HiLink hi def link <args>
172     endif
174     HiLink factorComment        Comment
175     HiLink factorStackEffect    Typedef
176     HiLink factorTodo           Todo
177     HiLink factorInclude        Include
178     HiLink factorRepeat         Repeat
179     HiLink factorConditional    Conditional
180     HiLink factorKeyword        Keyword
181     HiLink factorOperator       Operator
182     HiLink factorBoolean        Boolean
183     HiLink factorDefnDelims     Typedef
184     HiLink factorMethodDelims   Typedef
185     HiLink factorGenericDelims        Typedef
186     HiLink factorGenericNDelims        Typedef
187     HiLink factorConstructor    Typedef
188     HiLink factorPrivate        Special
189     HiLink factorPrivateDefnDelims      Special
190     HiLink factorPrivateMethodDelims    Special
191     HiLink factorPGenericDelims        Special
192     HiLink factorPGenericNDelims        Special
193     HiLink factorString         String
194     HiLink factorSbuf           String
195     HiLink factorMultiStringContents            String
196     HiLink factorMultiStringDelims Typedef
197     HiLink factorBracketErr     Error
198     HiLink factorComplex        Number
199     HiLink factorRatio          Number
200     HiLink factorBinary         Number
201     HiLink factorBinErr         Error
202     HiLink factorHex            Number
203     HiLink factorHexErr         Error
204     HiLink factorOctal          Number
205     HiLink factorOctErr         Error
206     HiLink factorFloat          Float
207     HiLink factorInt            Number
208     HiLink factorUsing          Include
209     HiLink factorUse            Include
210     HiLink factorRequires       Include
211     HiLink factorIn             Define
212     HiLink factorChar           Character
213     HiLink factorCharErr        Error
214     HiLink factorDelimiter      Delimiter
215     HiLink factorBackslash      Special
216     HiLink factorCompileDirective Typedef
217     HiLink factorSymbol         Define
218     HiLink factorMixin         Typedef
219     HiLink factorInstance         Typedef
220     HiLink factorHook         Typedef
221     HiLink factorMain         Define
222     HiLink factorPostpone       Define
223     HiLink factorDefer          Define
224     HiLink factorForget         Define
225     HiLink factorAlien          Define
226     HiLink factorTuple          Typedef
228     if &bg == "dark"
229         hi   hlLevel0 ctermfg=red         guifg=red1
230         hi   hlLevel1 ctermfg=yellow      guifg=orange1
231         hi   hlLevel2 ctermfg=green       guifg=yellow1
232         hi   hlLevel3 ctermfg=cyan        guifg=greenyellow
233         hi   hlLevel4 ctermfg=magenta     guifg=green1
234         hi   hlLevel5 ctermfg=red         guifg=springgreen1
235         hi   hlLevel6 ctermfg=yellow      guifg=cyan1
236         hi   hlLevel7 ctermfg=green       guifg=slateblue1
237         hi   hlLevel8 ctermfg=cyan        guifg=magenta1
238         hi   hlLevel9 ctermfg=magenta     guifg=purple1
239     else
240         hi   hlLevel0 ctermfg=red         guifg=red3
241         hi   hlLevel1 ctermfg=darkyellow  guifg=orangered3
242         hi   hlLevel2 ctermfg=darkgreen   guifg=orange2
243         hi   hlLevel3 ctermfg=blue        guifg=yellow3
244         hi   hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
245         hi   hlLevel5 ctermfg=red         guifg=green4
246         hi   hlLevel6 ctermfg=darkyellow  guifg=paleturquoise3
247         hi   hlLevel7 ctermfg=darkgreen   guifg=deepskyblue4
248         hi   hlLevel8 ctermfg=blue        guifg=darkslateblue
249         hi   hlLevel9 ctermfg=darkmagenta guifg=darkviolet
250     endif
252     delcommand HiLink
253 endif
255 let b:current_syntax = "factor"
257 set sw=4
258 set ts=4
259 set expandtab
260 set autoindent " annoying?
262 " vim: syntax=vim