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!
|
|
6 " -------------------------------------------------------------------------------
|
|
7 " GetLatestVimScripts: 2745 1 :AutoInstall: falcon.vim
|
|
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
|
|
59
|
|
60 " Comments
|
|
61 syn match falconCommentSkip contained "^\s*\*\($\|\s\+\)"
|
|
62 syn region falconComment start="/\*" end="\*/" contains=@falconCommentGroup,falconSpaceError,falconTodo
|
|
63 syn region falconCommentL start="//" end="$" keepend contains=@falconCommentGroup,falconSpaceError,falconTodo
|
|
64 syn match falconSharpBang "\%^#!.*" display
|
|
65 syn sync ccomment falconComment
|
|
66
|
|
67 " Numbers
|
|
68 syn match falconNumbers transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=falconIntLiteral,falconFloatLiteral,falconHexadecimal,falconOctal
|
|
69 syn match falconNumbersCom contained transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=falconIntLiteral,falconFloatLiteral,falconHexadecimal,falconOctal
|
|
70 syn match falconHexadecimal contained "\<0x\x\+\>"
|
|
71 syn match falconOctal contained "\<0\o\+\>"
|
|
72 syn match falconIntLiteral contained "[+-]\<d\+\(\d\+\)\?\>"
|
|
73 syn match falconFloatLiteral contained "[+-]\=\d\+\.\d*"
|
|
74 syn match falconFloatLiteral contained "[+-]\=\d*\.\d*"
|
|
75
|
|
76 " Includes
|
|
77 syn keyword falconInclude load import
|
|
78
|
|
79 " Expression Substitution and Backslash Notation
|
|
80 syn match falconStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
|
81 syn match falconStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
|
82 syn region falconSymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=falconStringEscape fold
|
|
83
|
|
84 " Normal String and Shell Command Output
|
|
85 syn region falconString matchgroup=falconStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=falconStringEscape fold
|
|
86 syn region falconString matchgroup=falconStringDelimiter start="'" end="'" skip="\\\\\|\\'" fold
|
|
87 syn region falconString matchgroup=falconStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=falconStringEscape fold
|
|
88
|
|
89 " Generalized Single Quoted String, Symbol and Array of Strings
|
|
90 syn region falconString matchgroup=falconStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
|
91 syn region falconString matchgroup=falconStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=falconDelimEscape
|
|
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 falconSymbol matchgroup=falconSymbolDelimiter start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
|
96 syn region falconSymbol matchgroup=falconSymbolDelimiter start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=falconDelimEscape
|
|
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
|
|
101 " Generalized Double Quoted String and Array of Strings and Shell Command Output
|
|
102 syn region falconString matchgroup=falconStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=falconStringEscape fold
|
|
103 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=falconStringEscape fold
|
|
104 syn region falconString matchgroup=falconStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=falconStringEscape,falconDelimEscape 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
|
|
109 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<\z(\h\w*\)\ze+hs=s+2 matchgroup=falconStringDelimiter end=+^\z1$+ contains=falconStringEscape fold keepend
|
|
110 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<"\z([^"]*\)"\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$+ fold keepend
|
|
112 syn region falconString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<`\z([^`]*\)`\ze+hs=s+2 matchgroup=falconStringDelimiter end=+^\z1$+ contains=falconStringEscape fold keepend
|
|
113
|
|
114 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
|
|
115 syn region falconString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-"\z([^"]*\)"\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$+ fold keepend
|
|
117 syn region falconString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3 matchgroup=falconStringDelimiter end=+^\s*\zs\z1$+ contains=falconStringEscape fold keepend
|
|
118
|
|
119 " Syntax Synchronizing
|
|
120 syn sync minlines=10 maxlines=100
|
|
121
|
|
122 " Define the default highlighting
|
|
123 if !exists("did_falcon_syn_inits")
|
|
124 command -nargs=+ HiLink hi def link <args>
|
|
125
|
|
126 HiLink falconKeyword Keyword
|
|
127 HiLink falconCommentString String
|
|
128 HiLink falconTodo Todo
|
|
129 HiLink falconConditional Keyword
|
|
130 HiLink falconRepeat Repeat
|
|
131 HiLink falconcommentSkip Comment
|
|
132 HiLink falconComment Comment
|
|
133 HiLink falconCommentL Comment
|
|
134 HiLink falconConst Constant
|
|
135 HiLink falconOperator Operator
|
|
136 HiLink falconSymbol Normal
|
|
137 HiLink falconSpaceError Error
|
|
138 HiLink falconHexadecimal Number
|
|
139 HiLink falconOctal Number
|
|
140 HiLink falconIntLiteral Number
|
|
141 HiLink falconFloatLiteral Float
|
|
142 HiLink falconStringEscape Special
|
|
143 HiLink falconStringDelimiter Delimiter
|
|
144 HiLink falconString String
|
|
145 HiLink falconBool Constant
|
|
146 HiLink falconSharpBang PreProc
|
|
147 HiLink falconInclude Include
|
|
148 HiLink falconSymbol Constant
|
|
149 HiLink falconSymbolOther Delimiter
|
|
150 delcommand HiLink
|
|
151 endif
|
|
152
|
|
153 let b:current_syntax = "falcon"
|
|
154
|
|
155 " vim: set sw=4 sts=4 et tw=80 :
|