-
Notifications
You must be signed in to change notification settings - Fork 0
/
tinyps.vim
185 lines (161 loc) · 6.08 KB
/
tinyps.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
" Vim syntax file
" Language: Tiny (A PowerShell Language)
" Maintainer: Bruce Payette
" Version: 0.1
" Project Repository: https://github.com/brucepay
" Vim Script Page: http://www.vim.org/scripts/
"
" The following settings are available for tuning syntax highlighting:
" let tiny_nofold_blocks = 1
" let tiny_nofold_region = 1
" Compatible VIM syntax file start
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" Operators contain dashes
"setlocal iskeyword+=-
" Tiny doesn't care about case
syn case ignore
" Sync-ing method
syn sync minlines=100
" Certain tokens can't appear at the top level of the document
syn cluster tinyNotTop contains=@tinyComment,tinyCDocParam,tinyFunctionDeclaration
" Comments and special comment words
syn keyword tinyCommentTodo TODO FIXME XXX TBD HACK NOTE BUGBUG contained
syn region tinyComment start=/\<#/ end=/#\>/ contains=tinyCommentTodo,tinyCommentDoc,@Spell
syn match tinyComment /#.*/ contains=tinyCommentTodo,tinyCommentDoc,@Spell
syn match tinyCDocParam /.*/ contained
syn match tinyCommentDoc /^\s*\zs\.\w\+\>/ nextgroup=tinyCDocParam contained
syn match tinyCommentDoc /#\s*\zs\.\w\+\>/ nextgroup=tinyCDocParam contained
" Language keywords and elements
syn keyword tinyConditional if else elseif match
syn keyword tinyRepeat while foreach matchlist
syn match tinyRepeat /\<foreach\>/ nextgroup=tinyBlock skipwhite
syn match tinyKeyword /\<while\>/ nextgroup=tinyBlock skipwhite
syn keyword tinyKeyword fn def undef match matchlist while foreach break continue
syn keyword tinyKeyword try catch finally throw return import
syn keyword tinyConstant true false null _ Pid TinyHome __global IsLinux IsMacOS IsWindows IsCoreCLR
" Function declarations
syn keyword tinyKeyword fn nextgroup=tinyFunctionDeclaration skipwhite
syn keyword tinyKeyword def nextgroup=tinyFunctionDeclaration skipwhite
syn match tinyFunctionDeclaration /fn\b*\w\+\(-\w\+\)*/ contained
" Function invocations
syn match tinyFunctionInvocation /\w\+\b*(/
" Variable references
syn match tinyVariable /\^\?\w\+/
" Tiny Operators
syn keyword tinyOperator is isnot as then do
syn match tinyOperator /!/
syn match tinyOperator /=/
syn match tinyOperator /+=/
syn match tinyOperator /-=/
syn match tinyOperator /\*=/
syn match tinyOperator /\/=/
syn match tinyOperator /%=/
syn match tinyOperator /+/
syn match tinyOperator /\*/
syn match tinyOperator /\*\*/
syn match tinyOperator /\//
syn match tinyOperator /|/
syn match tinyOperator /||/
syn match tinyOperator /%/
syn match tinyOperator /&&/
syn match tinyOperator /{::/
syn match tinyOperator /::}/
syn match tinyOperator /::[^}]/
syn match tinyOperator /,/
syn match tinyOperator /\./
syn match tinyOperator /\.\./
syn match tinyOperator /:+/
syn match tinyOperator /|>/
syn match tinyOperator /:>/
syn match tinyOperator /!:>/
syn match tinyOperator /<:/
syn match tinyOperator /!<:/
syn match tinyOperator /</
syn match tinyOperator /<=/
syn match tinyOperator />/
syn match tinyOperator />=/
syn match tinyOperator /==/
syn match tinyOperator /!=/
syn match tinyOperator /\.\./
syn match tinyOperator /->/
syn match tinyOperator /??/
syn match tinyOperator /?\./
syn match tinyOperator /?\[/
syn match tinyOperator /\~/
syn match tinyOperator /\*\~/
syn match tinyOperator /-\~/
syn match tinyOperator /\/\~/
syn match tinyOperator /\[/
syn match tinyOperator /\]/
syn match tinyOperator /:/
syn match tinyOperator /`[a-z0-9]\+`/
" Type literals
syn match tinyType /\[\<[a-z_][a-z0-9_.,\[\]]\+\>\]/
" Regular expressions...
syn region tinyString start=/r\// skip=/\/\// end=/\//
" Strings
syn region tinyString start=/"/ skip=/""|\\"/ end=/"/ contains=@Spell
syn region tinyString start=/'/ skip=/''/ end=/'/ contains=@Spell
" Interpolation in strings
syn match tinyEscape /`./
syn region tinyInterpolation matchgroup=tinyInterpolationDelimiter start="${" end="}" contained contains=ALLBUT,@tinyNotTop
syn region tinyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=tinyInterpolation end=")" transparent contained
syn cluster tinyStringSpecial contains=tinyEscape,tinyInterpolation,tinyVariable,tinyBoolean,tinyConstant,tinyBuiltIn,@Spell
" Numbers
syn match tinyNumber "\(\<\|-\)\@<=\(0[xX]\x\+\|\d\+\)\([KMGTP][B]\)\=\(\>\|-\)\@="
syn match tinyNumber "\(\(\<\|-\)\@<=\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
syn match tinyNumber "\<\d\+[eE][-+]\=\d\+[dD]\=\>"
syn match tinyNumber "\<\d\+\([eE][-+]\=\d\+\)\=[dD]\>"
" Constants
syn match tinyBoolean "\%(true\|false\)\>"
syn match tinyConstant /\null\>/
syn match tinyBuiltIn "$^\|$?\|$_\|$\$"
syn match tinyBuiltIn "$\%(args\|error\|foreach\|home\|input\)\>"
syn match tinyBuiltIn "$\%(match\(es\)\?\|myinvocation\|host\|lastexitcode\)\>"
syn match tinyBuiltIn "$\%(ofs\|shellid\|stacktrace\)\>"
" Folding blocks
if !exists('g:tiny_nofold_blocks')
syn region tinyBlock start=/{/ end=/}/ transparent fold
endif
if !exists('g:tiny_nofold_region')
syn region tinyRegion start=/#region/ end=/#endregion/ transparent fold keepend extend
endif
" Setup default color highlighting
if version >= 508 || !exists("did_tiny_syn_inits")
if version < 508
let did_tiny_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink tinyNumber Number
HiLink tinyBlock Block
HiLink tinyRegion Region
HiLink tinyException Exception
HiLink tinyConstant Constant
HiLink tinyString String
HiLink tinyEscape SpecialChar
HiLink tinyInterpolationDelimiter Delimiter
HiLink tinyConditional Conditional
HiLink tinyFunctionDeclaration Function
HiLink tinyFunctionInvocation Function
HiLink tinyVariable Identifier
HiLink tinyBoolean Boolean
HiLink tinyConstant Constant
HiLink tinyBuiltIn StorageClass
HiLink tinyType Type
HiLink tinyComment Comment
HiLink tinyCommentTodo Todo
HiLink tinyCommentDoc Tag
HiLink tinyCDocParam Todo
HiLink tinyOperator Operator
HiLink tinyRepeat Repeat
HiLink tinyRepeatAndCmdlet Repeat
HiLink tinyKeyword Keyword
delcommand HiLink
endif
let b:current_syntax = "tinyps"