2596
|
1 " Vim syntax file
|
|
2 " Language: Falcon
|
|
3 " Maintainer: Steven Oliver <oliver.steven@gmail.com>
|
|
4 " Website: http://github.com/steveno/vim-files/blob/master/syntax/falcon.vim
|
|
5 " Credits: Thanks the ruby.vim authors, I borrowed a lot!
|
4780
|
6 " Thanks to the lisp authors for the rainbow code!
|
2596
|
7 " -------------------------------------------------------------------------------
|
|
8
|
|
9 " When wanted, highlight the trailing whitespace.
|
|
10 if exists("c_space_errors")
|
|
11 if !exists("c_no_trail_space_error")
|
|
12 syn match falconSpaceError "\s\+$"
|
|
13 endif
|
|
14
|
|
15 if !exists("c_no_tab_space_error")
|
|
16 syn match falconSpaceError " \+\t"me=e-1
|
|
17 endif
|
|
18 endif
|
|
19
|
|
20 " Symbols
|
|
21 syn match falconSymbol "\(;\|,\|\.\)"
|
|
22 syn match falconSymbolOther "\(#\|@\)" display
|
|
23
|
|
24 " Operators
|
|
25 syn match falconOperator "\(+\|-\|\*\|/\|=\|<\|>\|\*\*\|!=\|\~=\)"
|
|
26 syn match falconOperator "\(<=\|>=\|=>\|\.\.\|<<\|>>\|\"\)"
|
|
27
|
|
28 " Clusters
|
|
29 syn region falconSymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@falconStringSpecial fold
|
|
30 syn case match
|
|
31
|
|
32 " Keywords
|
|
33 syn keyword falconKeyword all allp any anyp as attributes brigade cascade catch choice class const
|
|
34 syn keyword falconKeyword continue def directive do list dropping enum eq eval exit export from function
|
|
35 syn keyword falconKeyword give global has hasnt in init innerfunc lambda launch launch len List list
|
|
36 syn keyword falconKeyword load notin object pass print printl provides raise return self sender static to
|
|
37 syn keyword falconKeyword try xamp
|
|
38
|
|
39 " Error Type Keywords
|
|
40 syn keyword falconKeyword CloneError CodeError Error InterruprtedError IoError MathError
|
|
41 syn keyword falconKeyword ParamError RangeError SyntaxError TraceStep TypeError
|
|
42
|
|
43 " Todo
|
|
44 syn keyword falconTodo DEBUG FIXME NOTE TODO XXX
|
|
45
|
|
46 " Conditionals
|
|
47 syn keyword falconConditional and case default else end if iff
|
|
48 syn keyword falconConditional elif or not switch select
|
|
49 syn match falconConditional "end\s\if"
|
|
50
|
|
51 " Loops
|
|
52 syn keyword falconRepeat break for loop forfirst forlast formiddle while
|
|
53
|
|
54 " Booleans
|
|
55 syn keyword falconBool true false
|
|
56
|
|
57 " Constants
|
|
58 syn keyword falconConst PI E nil
|
4780
|
59 syn match falconConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@!"
|
2596
|
60
|
|
61 " Comments
|
|
62 syn match falconCommentSkip contained "^\s*\*\($\|\s\+\)"
|
|
63 syn region falconComment start="/\*" end="\*/" contains=@falconCommentGroup,falconSpaceError,falconTodo
|
|
64 syn region falconCommentL start="//" end="$" keepend contains=@falconCommentGroup,falconSpaceError,falconTodo
|
|
65 syn match falconSharpBang "\%^#!.*" display
|
|
66 syn sync ccomment falconComment
|
|
67
|
|
68 " Numbers
|
|
69 syn match falconNumbers transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=falconIntLiteral,falconFloatLiteral,falconHexadecimal,falconOctal
|
|
70 syn match falconNumbersCom contained transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=falconIntLiteral,falconFloatLiteral,falconHexadecimal,falconOctal
|
|
71 syn match falconHexadecimal contained "\<0x\x\+\>"
|
|
72 syn match falconOctal contained "\<0\o\+\>"
|
|
73 syn match falconIntLiteral contained "[+-]\<d\+\(\d\+\)\?\>"
|
|
74 syn match falconFloatLiteral contained "[+-]\=\d\+\.\d*"
|
|
75 syn match falconFloatLiteral contained "[+-]\=\d*\.\d*"
|
|
76
|
|
77 " Includes
|
|
78 syn keyword falconInclude load import
|
|
79
|
|
80 " Expression Substitution and Backslash Notation
|
|
81 syn match falconStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
|
82 syn match falconStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
|
83 syn region falconSymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=falconStringEscape fold
|
|
84
|
|
85 " Normal String and Shell Command Output
|
|
86 syn region falconString matchgroup=falconStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=falconStringEscape fold
|
|
87 syn region falconString matchgroup=falconStringDelimiter start="'" end="'" skip="\\\\\|\\'" fold
|
|
88 syn region falconString matchgroup=falconStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=falconStringEscape fold
|
|
89
|
|
90 " Generalized Single Quoted String, Symbol and Array of Strings
|
|
91 syn region falconString matchgroup=falconStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
|
92 syn region falconString matchgroup=falconStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=falconDelimEscape
|
|
93 syn region falconString matchgroup=falconStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=falconDelimEscape
|
|
94 syn region falconString matchgroup=falconStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=falconDelimEscape
|
|
95 syn region falconString matchgroup=falconStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=falconDelimEscape
|
|
96 syn region falconSymbol matchgroup=falconSymbolDelimiter start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
|
97 syn region falconSymbol matchgroup=falconSymbolDelimiter start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=falconDelimEscape
|
|
98 syn region falconSymbol matchgroup=falconSymbolDelimiter start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=falconDelimEscape
|
|
99 syn region falconSymbol matchgroup=falconSymbolDelimiter start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=falconDelimEscape
|
|
100 syn region falconSymbol matchgroup=falconSymbolDelimiter start="%[s](" end=")" skip="\\\\\|\\)" fold contains=falconDelimEscape
|
|
101
|
|
102 " Generalized Double Quoted String and Array of Strings and Shell Command Output
|
|
103 syn region falconString matchgroup=falconStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=falconStringEscape fold
|
|
104 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=falconStringEscape fold
|
|
105 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=falconStringEscape,falconDelimEscape fold
|
|
106 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=falconStringEscape,falconDelimEscape fold
|
|
107 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=falconStringEscape,falconDelimEscape fold
|
|
108 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=falconStringEscape,falconDelimEscape fold
|
|
109
|
|
110 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<\z(\h\w*\)\ze+hs=s+2 matchgroup=falconStringDelimiter end=+^\z1$+ contains=falconStringEscape fold keepend
|
|
111 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<"\z([^"]*\)"\ze+hs=s+2 matchgroup=falconStringDelimiter end=+^\z1$+ contains=falconStringEscape fold keepend
|
|
112 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<'\z([^']*\)'\ze+hs=s+2 matchgroup=falconStringDelimiter end=+^\z1$+ fold keepend
|
|
113 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<`\z([^`]*\)`\ze+hs=s+2 matchgroup=falconStringDelimiter end=+^\z1$+ contains=falconStringEscape fold keepend
|
|
114
|
|
115 syn region falconString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-\z(\h\w*\)\ze+hs=s+3 matchgroup=falconStringDelimiter end=+^\s*\zs\z1$+ contains=falconStringEscape fold keepend
|
|
116 syn region falconString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-"\z([^"]*\)"\ze+hs=s+3 matchgroup=falconStringDelimiter end=+^\s*\zs\z1$+ contains=falconStringEscape fold keepend
|
|
117 syn region falconString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-'\z([^']*\)'\ze+hs=s+3 matchgroup=falconStringDelimiter end=+^\s*\zs\z1$+ fold keepend
|
|
118 syn region falconString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3 matchgroup=falconStringDelimiter end=+^\s*\zs\z1$+ contains=falconStringEscape fold keepend
|
|
119
|
4780
|
120 " Falcon rainbox to highlight parens in varying colors
|
|
121 if exists("g:falcon_rainbow") && g:falcon_rainbow != 0
|
|
122 syn region falconParen0 matchgroup=hlLevel0 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen1
|
|
123 syn region falconParen1 contained matchgroup=hlLevel1 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen2
|
|
124 syn region falconParen2 contained matchgroup=hlLevel2 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen3
|
|
125 syn region falconParen3 contained matchgroup=hlLevel3 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen4
|
|
126 syn region falconParen4 contained matchgroup=hlLevel4 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen5
|
|
127 syn region falconParen5 contained matchgroup=hlLevel5 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen6
|
|
128 syn region falconParen6 contained matchgroup=hlLevel6 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen7
|
|
129 syn region falconParen7 contained matchgroup=hlLevel7 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen8
|
|
130 syn region falconParen8 contained matchgroup=hlLevel8 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen9
|
|
131 syn region falconParen9 contained matchgroup=hlLevel9 start="`\=(" end=")" skip="|.\{-}|" contains=@falconListCluster,falconParen0
|
|
132 endif
|
|
133
|
|
134 " Setup the colors for the rainbox
|
|
135 if exists("g:falcon_rainbow") && g:falcon_rainbow != 0
|
|
136 if &bg == "dark"
|
|
137 hi def hlLevel0 ctermfg=red guifg=red1
|
|
138 hi def hlLevel1 ctermfg=yellow guifg=orange1
|
|
139 hi def hlLevel2 ctermfg=green guifg=yellow1
|
|
140 hi def hlLevel3 ctermfg=cyan guifg=greenyellow
|
|
141 hi def hlLevel4 ctermfg=magenta guifg=green1
|
|
142 hi def hlLevel5 ctermfg=red guifg=springgreen1
|
|
143 hi def hlLevel6 ctermfg=yellow guifg=cyan1
|
|
144 hi def hlLevel7 ctermfg=green guifg=slateblue1
|
|
145 hi def hlLevel8 ctermfg=cyan guifg=magenta1
|
|
146 hi def hlLevel9 ctermfg=magenta guifg=purple1
|
|
147 else
|
|
148 hi def hlLevel0 ctermfg=red guifg=red3
|
|
149 hi def hlLevel1 ctermfg=darkyellow guifg=orangered3
|
|
150 hi def hlLevel2 ctermfg=darkgreen guifg=orange2
|
|
151 hi def hlLevel3 ctermfg=blue guifg=yellow3
|
|
152 hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
|
|
153 hi def hlLevel5 ctermfg=red guifg=green4
|
|
154 hi def hlLevel6 ctermfg=darkyellow guifg=paleturquoise3
|
|
155 hi def hlLevel7 ctermfg=darkgreen guifg=deepskyblue4
|
|
156 hi def hlLevel8 ctermfg=blue guifg=darkslateblue
|
|
157 hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet
|
|
158 endif
|
|
159 endif
|
|
160
|
2596
|
161 " Syntax Synchronizing
|
|
162 syn sync minlines=10 maxlines=100
|
|
163
|
|
164 " Define the default highlighting
|
|
165 if !exists("did_falcon_syn_inits")
|
|
166 command -nargs=+ HiLink hi def link <args>
|
|
167
|
|
168 HiLink falconKeyword Keyword
|
|
169 HiLink falconCommentString String
|
|
170 HiLink falconTodo Todo
|
|
171 HiLink falconConditional Keyword
|
|
172 HiLink falconRepeat Repeat
|
|
173 HiLink falconcommentSkip Comment
|
|
174 HiLink falconComment Comment
|
|
175 HiLink falconCommentL Comment
|
|
176 HiLink falconConst Constant
|
4780
|
177 HiLink falconConstants Constant
|
2596
|
178 HiLink falconOperator Operator
|
|
179 HiLink falconSymbol Normal
|
|
180 HiLink falconSpaceError Error
|
|
181 HiLink falconHexadecimal Number
|
|
182 HiLink falconOctal Number
|
|
183 HiLink falconIntLiteral Number
|
|
184 HiLink falconFloatLiteral Float
|
|
185 HiLink falconStringEscape Special
|
|
186 HiLink falconStringDelimiter Delimiter
|
|
187 HiLink falconString String
|
|
188 HiLink falconBool Constant
|
|
189 HiLink falconSharpBang PreProc
|
|
190 HiLink falconInclude Include
|
|
191 HiLink falconSymbol Constant
|
|
192 HiLink falconSymbolOther Delimiter
|
|
193 delcommand HiLink
|
|
194 endif
|
|
195
|
|
196 let b:current_syntax = "falcon"
|
|
197
|
|
198 " vim: set sw=4 sts=4 et tw=80 :
|
4780
|
199
|