Mercurial > vim
annotate runtime/syntax/pike.vim @ 34416:0a458b49e1e6 v9.1.0131
patch 9.1.0131: buffer-completion may not always find all matches
Commit: https://github.com/vim/vim/commit/0dc0bff000fd804c6b0778ccc4554a4e4c82c8c9
Author: Christian Brabandt <cb@256bit.org>
Date: Sat Feb 24 14:12:13 2024 +0100
patch 9.1.0131: buffer-completion may not always find all matches
Problem: buffer-completion code too complicated and does not always
find all matches (irisjae)
Solution: do not try to anchor pattern to beginning of line or
directory-separator, always return all matches
Note: we are considering the non-fuzzy buffer-matching here.
Currently, the buffer-completion code makes 2 attempts to match a
pattern against the list of available patterns. First try is to match
the pattern and anchor it to either the beginning of the file name or
at a directory-separator (// or \\).
When a match is found, Vim returns the matching buffers and does not try
to find a match anywhere within a buffer name. So if you have opened two
buffers like /tmp/Foobar.c and /tmp/MyFoobar.c using `:b Foo` will only
complete to the first filename, but not the second (the same happens
with `getcompletion('Foo', 'buffer')`).
It may make sense, that completion priorities buffer names at directory
boundaries, but it inconsistent, may cause confusion why a certain
buffer name is not completed when typing `:b Foo<C-D>` which returns
only a single file name and then pressing Enter (to switch to that
buffer), Vim will error with 'E93: More than one match for Foo').
Similar things may happen when wiping the /tmp/Foobar.c pattern and
afterwards the completion starts completing other buffers.
So let's simplify the code and always match the pattern anywhere in the
buffer name, do not try to favor matches at directory boundaries. This
is also simplifies the code a bit, we do not need to run over the list
of buffers several times, but only twice.
fixes #13894
closes: #14082
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 24 Feb 2024 14:30:03 +0100 |
parents | 371ceeebbdaa |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
13125 | 2 " Language: Pike |
3 " Maintainer: Stephen R. van den Berg <srb@cuci.nl> | |
4 " Maintainer of previous implementation: Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> | |
5 " Last Change: 2018 Jan 28 | |
6 " Version: 2.9 | |
7 " Remark: Derived from the C-syntax; fixed several bugs in the C-syntax | |
8 " Remark: and extended it with the Pike syntax. | |
9 " Remark: Includes a highlighter for all Pike types of parenthesis errors. | |
10 " Remark: Includes a highlighter for SQL on multiline strings. | |
11 " Remark: Includes a highlighter for any embedded Autodoc format. | |
7 | 12 |
13125 | 13 " Quit when a (custom) syntax file was already loaded |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
14 if exists("b:current_syntax") |
7 | 15 finish |
16 endif | |
17 | |
13125 | 18 let s:cpo_save = &cpo |
19 set cpo&vim | |
20 | |
21 " For multiline strings, try formatting them as SQL | |
22 syn include @pikeSQL <sfile>:p:h/sqloracle.vim | |
23 unlet b:current_syntax | |
24 | |
25 " For embedded Autodoc documentation (WIP) | |
26 syn include @pikeAutodoc <sfile>:p:h/autodoc.vim | |
27 unlet b:current_syntax | |
28 | |
29 syn case match | |
30 | |
31 " Supports array, multiset, mapping multi-character delimiter matching | |
32 " Supports rotating amongst several same-level preprocessor conditionals | |
33 packadd! matchit | |
34 let b:match_words = "({:}\\@1<=),(\\[:]\\@1<=),(<:>\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>" | |
35 | |
36 " A bunch of useful Pike keywords | |
37 syn keyword pikeDebug gauge backtrace describe_backtrace werror _Static_assert static_assert | |
38 syn keyword pikeException error catch throw | |
39 syn keyword pikeLabel case default break return continue | |
40 syn keyword pikeConditional if else switch | |
41 syn keyword pikeRepeat while for foreach do | |
7 | 42 |
13125 | 43 syn keyword pikePredef RegGetKeyNames RegGetValue RegGetValues |
44 syn keyword pikePredef __automap__ __empty_program | |
45 syn keyword pikePredef __handle_sprintf_format __parse_pike_type _disable_threads | |
46 syn keyword pikePredef _do_call_outs _exit _gdb_breakpoint | |
47 syn keyword pikePredef abs access acos acosh add_constant alarm all_constants | |
48 syn keyword pikePredef array_sscanf asin asinh atan atan2 atanh atexit | |
49 syn keyword pikePredef basetype call_function call_out call_out_info cd ceil | |
50 syn keyword pikePredef combine_path combine_path_nt | |
51 syn keyword pikePredef combine_path_unix compile copy_value cos cosh cpp crypt | |
52 syn keyword pikePredef ctime decode_value delay encode_value encode_value_canonic | |
53 syn keyword pikePredef enumerate errno exece exit exp file_stat file_truncate | |
54 syn keyword pikePredef filesystem_stat find_call_out floor fork function_name | |
55 syn keyword pikePredef function_object function_program gc | |
56 syn keyword pikePredef get_active_compilation_handler get_active_error_handler | |
57 syn keyword pikePredef get_all_groups get_all_users get_dir get_groups_for_user | |
58 syn keyword pikePredef get_iterator get_profiling_info get_weak_flag getcwd | |
59 syn keyword pikePredef getgrgid getgrnam gethrdtime gethrtime gethrvtime getpid | |
60 syn keyword pikePredef getpwnam getpwuid getxattr glob gmtime has_index has_prefix | |
61 syn keyword pikePredef has_suffix has_value hash hash_7_0 hash_7_4 hash_8_0 | |
62 syn keyword pikePredef hash_value kill limit listxattr load_module localtime | |
63 syn keyword pikePredef log lower_case master max min mkdir mktime mv | |
64 syn keyword pikePredef object_program pow query_num_arg random_seed | |
65 syn keyword pikePredef remove_call_out removexattr replace_master rm round | |
66 syn keyword pikePredef set_priority set_weak_flag setxattr sgn signal signame | |
67 syn keyword pikePredef signum sin sinh sleep sort sprintf sqrt sscanf strerror | |
68 syn keyword pikePredef string_filter_non_unicode string_to_unicode string_to_utf8 | |
69 syn keyword pikePredef tan tanh time trace types ualarm unicode_to_string | |
70 syn keyword pikePredef upper_case utf8_to_string version | |
7 | 71 |
13125 | 72 syn keyword pikePredef write lock try_lock |
73 syn keyword pikePredef MutexKey Timestamp Date Time TimeTZ Interval Inet Range | |
74 syn keyword pikePredef Null null inf nan | |
75 | |
76 syn keyword pikeTodo contained TODO FIXME XXX | |
77 | |
78 " Match parengroups: allows for highlighting indices of mappings and | |
79 " highlighting semicolons that are out of place due to a paren imbalance | |
80 syn cluster pikePreShort contains=pikeDefine,pikePreProc,pikeCppOutWrapper,pikeCppInWrapper,pikePreCondit,pikePreConditMatch | |
81 syn cluster pikeExprGroup contains=pikeMappIndex,@pikeStmt,pikeNest,@pikeBadGroup,pikeSoftCast | |
82 syn match pikeWord transparent contained /[^()'"[\]{},;:]\+/ contains=ALLBUT,@pikePreProcGroup,@pikeExprGroup | |
83 syn match pikeFirstWord transparent display contained /^\s*#[^()'"[\]{},;:]\+/ contains=@pikePreShort | |
84 syn cluster pikeMappElm contains=pikeMappIndex,@pikeStmt | |
85 syn cluster pikeStmt contains=pikeFirstWord,pikeCharacter,pikeString,pikeMlString,pikeWord,pikeNest | |
86 syn cluster pikeBadGroup contains=pikeBadPClose,pikeBadAClose,pikeBadBClose,pikeBadSPClose,pikeBadSAClose,pikeBadSBClose,pikeBadSClose,pikeBadSPAClose,pikeBadSBAClose | |
87 syn match pikeBadPClose display contained "[}\]]" | |
88 syn match pikeBadAClose display contained "[)\]]" | |
89 syn match pikeBadBClose display contained "[)}]" | |
90 syn match pikeBadSPClose display contained "[;}\]]" | |
91 syn match pikeBadSAClose display contained "[;)\]]" | |
92 syn match pikeBadSPAClose display contained "[;\]]" | |
93 syn match pikeBadSBAClose display contained "[;}]" | |
94 syn match pikeBadSClose display contained "[;)}\]]" | |
95 syn region pikeNest transparent start="(\@1<!{" end="}" contains=@pikeStmt,pikeUserLabel,pikeBadAClose | |
96 syn region pikeNest transparent start="\%(\<for\%(each\)\?\s\?\)\@8<!([[{<]\@!" end=")" contains=@pikeStmt,pikeBadSPClose | |
97 syn region pikeNest transparent start="\%(\<for\%(each\)\?\s\?\)\@8<=(" end=")" contains=@pikeStmt,pikeBadPClose | |
98 syn region pikeNest transparent start="(\@1<!\[" end="]" contains=@pikeStmt,pikeBadSBClose | |
99 syn region pikeNest transparent start="(\zs\[" end="])" contains=@pikeMappElm,pikeBadSBAClose | |
100 " For some reason specifying a matchgroup on the pikeNest below makes it | |
101 " override the shorter variant; consider it a kludge, no idea why it works | |
102 syn region pikeNest transparent matchgroup=pikeSoftCast start=%(\zs\[[ \t\v\r\n.a-zA-Z0-9_():,|]\+])\@!% end=")" contains=@pikeStmt | |
103 syn region pikeNest transparent start="(\zs{" end="})" contains=@pikeStmt,pikeBadSPAClose | |
104 syn region pikeNest transparent start="(\zs<" end=">)" contains=@pikeStmt,pikeBadSPClose keepend | |
105 | |
106 " It's easy to accidentally add a space after a backslash that was intended | |
107 " for line continuation. Some compilers allow it, which makes it | |
108 " unpredictable and should be avoided. | |
109 syn match pikeBadContinuation contained "\\\s\+$" | |
110 | |
111 " pikeCommentGroup allows adding matches for special things in comments | |
112 syn cluster pikeCommentGroup contains=pikeTodo,pikeBadContinuation | |
7 | 113 |
114 " String and Character constants | |
115 " Highlight special characters (those which have a backslash) differently | |
13125 | 116 syn match pikeSpecial display contained "\\\%(x\x*\|d\d*\|\o\+\|u\x\{4}\|U\x\{8}\|[abefnrtv]\|$\)" |
117 | |
118 " ISO C11 or ISO C++ 11 | |
119 if !exists("c_no_cformat") | |
120 " Highlight % items in strings. | |
121 syn match pikeFormat display "%\%(\d\+\$\)\=[-+' #0*]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjzt]\|ll\|hh\)\=\%([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained | |
122 syn match pikeFormat display "%%" contained | |
123 syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,pikeFormat,@Spell keepend | |
124 syn region pikeMlString start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeFormat,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend | |
125 else | |
126 syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,@Spell | |
127 syn region pikeMlString transparent start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend | |
128 endif | |
7 | 129 |
13125 | 130 " Use SQL-syntax highlighting in multiline string if it starts with |
131 " a standard SQL keyword | |
132 syn case ignore | |
133 " FIXME Use explicit newline match to cover up a bug in the regexp engine | |
134 " If the kludge is not used, the match will only start unless at least a space | |
135 " follows the initial doublequote on the first line (or the keyword is on | |
136 " the first line). | |
137 syn region pikeEmbeddedString contained start=+\%(#"\n\?\)\@2<=\_s*\%(SELECT\|INSERT\|UPDATE\|DELETE\|WITH\|CREATE\|DROP\|ALTER\)\>+ skip=+\\\\\|\\"+ end=+[\\#]\@1<!"+ contains=@pikeSQL,pikeBindings keepend | |
138 syn case match | |
139 | |
140 syn match pikeBindings display contained ":\@1<!:\I\i*" | |
7 | 141 |
13125 | 142 syn match pikeCharacter "'[^\\']'" contains=pikeDelimiterSQ |
143 syn match pikeCharacter "'[^']*'" contains=pikeSpecial,pikeDelimiterSQ | |
144 syn match pikeSpecialError "'\\[^'\"?\\abefnrtv]'" | |
145 syn match pikeDelimiterDQ display +"+ contained | |
146 syn match pikeDelimiterSQ display +'+ contained | |
147 | |
148 "when wanted, highlight trailing white space | |
149 if exists("c_space_errors") | |
150 if !exists("c_no_trail_space_error") | |
151 syn match pikeSpaceError display excludenl "\s\+$" | |
152 endif | |
153 if !exists("c_no_tab_space_error") | |
154 syn match pikeSpaceError display " \+\ze\t" | |
155 endif | |
156 endif | |
7 | 157 |
158 "integer number, or floating point number without a dot and with "f". | |
159 syn case ignore | |
13125 | 160 syn match pikeNumbers display transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctalError,pikeOctal |
161 " Same, but without octal error (for comments) | |
162 syn match pikeNumbersCom display contained transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctal | |
163 syn match pikeNumber display contained "\<\d\+\%(u\=l\{0,2}\|ll\=u\)\>" | |
164 "hex number | |
165 syn match pikeNumber display contained "\<0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>" | |
166 " Flag the first zero of an octal number as something special | |
167 syn match pikeOctal display contained "\<0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=pikeOctalZero | |
168 syn match pikeOctalZero display contained "\<0" | |
7 | 169 "floating point number, with dot, optional exponent |
13125 | 170 syn match pikeFloat display contained "\<\d\+\%(f\|\.[0-9.]\@!\d*\%(e[-+]\=\d\+\)\=[fl]\=\)" |
7 | 171 "floating point number, starting with a dot, optional exponent |
13125 | 172 syn match pikeFloat display contained "[0-9.]\@1<!\.\d\+\%(e[-+]\=\d\+\)\=[fl]\=\>" |
7 | 173 "floating point number, without dot, with exponent |
13125 | 174 syn match pikeFloat display contained "\<\d\+e[-+]\=\d\+[fl]\=\>" |
175 | |
176 "hexadecimal floating point number, two variants, with exponent | |
177 syn match pikeFloat display contained "\<0x\%(\x\+\.\?\|\x*\.\x\+\)p[-+]\=\d\+[fl]\=\>" | |
178 | |
179 " flag an octal number with wrong digits | |
180 syn match pikeOctalError display contained "\<0\o*[89]\d*" | |
7 | 181 syn case match |
182 | |
183 if exists("c_comment_strings") | |
184 " A comment can contain pikeString, pikeCharacter and pikeNumber. | |
185 " But a "*/" inside a pikeString in a pikeComment DOES end the comment! So we | |
186 " need to use a special type of pikeString: pikeCommentString, which also ends on | |
187 " "*/", and sees a "*" at the start of the line as comment again. | |
188 " Unfortunately this doesn't very well work for // type of comments :-( | |
13125 | 189 syn match pikeCommentSkip contained "^\s*\*\%($\|\s\+\)" |
190 syn region pikeCommentString contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\ze\*/+ contains=pikeSpecial,pikeCommentSkip | |
191 syn region pikeComment2String contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=pikeSpecial | |
192 syn region pikeCommentL start="//" skip="\\$" end="$" keepend contains=@pikeCommentGroup,pikeComment2String,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell containedin=pikeWord,pikeFirstWord | |
193 if exists("c_no_comment_fold") | |
194 " Use "extend" here to have preprocessor lines not terminate halfway a | |
195 " comment. | |
196 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeCommentString,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell extend containedin=pikeWord,pikeFirstWord | |
197 else | |
198 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeCommentString,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell fold extend containedin=pikeWord,pikeFirstWord | |
199 endif | |
7 | 200 else |
13125 | 201 syn region pikeCommentL start="//" skip="\\$" end="$" keepend contains=@pikeCommentGroup,pikeSpaceError,@Spell containedin=pikeWord,pikeFirstWord |
202 if exists("c_no_comment_fold") | |
203 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeSpaceError,@Spell extend containedin=pikeWord,pikeFirstWord | |
204 else | |
205 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeSpaceError,@Spell fold extend containedin=pikeWord,pikeFirstWord | |
206 endif | |
7 | 207 endif |
13125 | 208 " keep a // comment separately, it terminates a preproc. conditional |
209 syn match pikeCommentError display "\*/" | |
210 syn match pikeCommentStartError display "/\ze\*" contained | |
211 | |
212 syn keyword pikeOperator sizeof | |
213 syn keyword pikeOperator typeof _typeof _refs | |
214 syn keyword pikeOperator zero_type intp stringp arrayp mappingp multisetp | |
215 syn keyword pikeOperator objectp functionp programp callablep destructedp | |
216 syn keyword pikeOperator object_variablep undefinedp | |
217 syn keyword pikeOperator allocate equal | |
218 syn keyword pikeOperator aggregate aggregate_mapping aggregate_multiset | |
219 syn keyword pikeOperator map filter search replace reverse column rows | |
220 syn keyword pikeOperator indices values mkmapping mkmultiset m_delete sort | |
221 syn keyword pikeOperator m_delete destruct | |
222 syn keyword pikeOperator create _destruct _sprintf cast _encode _decode | |
223 syn keyword pikeOperator __hash _sizeof _values _indices __INIT _equal | |
224 syn keyword pikeOperator _is_type _m_delete _get_iterator _search | |
225 syn keyword pikeOperator _serialize _deserialize _sqrt _types _random | |
226 syn keyword pikeOperator _size_object | |
7 | 227 |
13125 | 228 syn keyword pikeType int void |
229 syn keyword pikeType float | |
230 syn keyword pikeType bool string array mapping multiset mixed | |
231 syn keyword pikeType object function program auto | |
232 | |
233 syn keyword pikeType this this_object this_program | |
234 syn keyword pikeType sprintf_args sprintf_format sprintf_result | |
235 syn keyword pikeType strict_sprintf_format | |
236 | |
237 syn keyword pikeStructure class enum typedef inherit import | |
238 syn keyword pikeTypedef typedef | |
239 syn keyword pikeStorageClass private protected public constant final variant | |
240 syn keyword pikeStorageClass optional inline extern static __deprecated__ lambda | |
241 | |
242 syn keyword pikeConstant __LINE__ __FILE__ __DIR__ __DATE__ __TIME__ | |
243 syn keyword pikeConstant __AUTO_BIGNUM__ __NT__ | |
244 syn keyword pikeConstant __BUILD__ __COUNTER__ _MAJOR__ __MINOR__ __VERSION__ | |
245 syn keyword pikeConstant __REAL_BUILD__ _REAL_MAJOR__ __REAL_MINOR__ | |
246 syn keyword pikeConstant __REAL_VERSION__ __PIKE__ UNDEFINED | |
7 | 247 |
13125 | 248 " These should actually only be parsed in preprocessor conditionals |
249 syn keyword pikeCppOperator contained defined constant efun _Pragma | |
250 | |
251 syn keyword pikeBoolean true false | |
252 | |
253 syn match pikeCppPrefix display "^\s*\zs#\s*[a-z]\+" contained | |
254 syn region pikePreCondit start="^\s*#\s*\%(if\%(n\?def\)\?\|el\%(se\)\?if\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix | |
255 syn match pikePreConditMatch display "^\s*\zs#\s*\%(else\|endif\)\>" | |
256 if !exists("c_no_if0") | |
257 syn cluster pikeCppOutInGroup contains=pikeCppInIf,pikeCppInElse,pikeCppInElse2,pikeCppOutIf,pikeCppOutIf2,pikeCppOutElse,pikeCppInSkip,pikeCppOutSkip | |
258 syn region pikeCppOutWrapper start="^\s*\zs#\s*if\s\+0\+\s*\%($\|//\|/\*\|&\)" end=".\@=\|$" contains=pikeCppOutIf,pikeCppOutElse,@NoSpell fold | |
259 syn region pikeCppOutIf contained start="0\+" matchgroup=pikeCppOutWrapper end="^\s*#\s*endif\>" contains=pikeCppOutIf2,pikeCppOutElse | |
260 if !exists("c_no_if0_fold") | |
261 syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell fold | |
262 else | |
263 syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell | |
264 endif | |
265 syn region pikeCppOutElse contained matchgroup=pikeCppOutWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit | |
266 syn region pikeCppInWrapper start="^\s*\zs#\s*if\s\+0*[1-9]\d*\s*\%($\|//\|/\*\||\)" end=".\@=\|$" contains=pikeCppInIf,pikeCppInElse fold | |
267 syn region pikeCppInIf contained matchgroup=pikeCppInWrapper start="\d\+" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit | |
268 if !exists("c_no_if0_fold") | |
269 syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 fold | |
270 else | |
271 syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 | |
272 endif | |
273 syn region pikeCppInElse2 contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)\%([^/]\|/[^/*]\)*" end="^\ze\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip,@Spell | |
274 syn region pikeCppOutSkip contained start="^\s*#\s*if\%(n\?def\)\?\>" skip="\\$" end="^\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip | |
275 syn region pikeCppInSkip contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(if\s\+\%(\d\+\s*\%($\|//\|/\*\||\|&\)\)\@!\|ifn\?def\>\)" skip="\\$" end="^\s*#\s*endif\>" containedin=pikeCppOutElse,pikeCppInIf,pikeCppInSkip contains=TOP,pikePreProc | |
276 endif | |
277 syn region pikeIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeDelimiterDQ keepend | |
278 syn match pikeIncluded display contained "<[^>]*>" | |
279 syn match pikeInclude display "^\s*\zs#\s*include\>\s*["<]" contains=pikeIncluded | |
280 syn cluster pikePreProcGroup contains=pikeIncluded,pikeInclude,pikeEmbeddedString,pikeCppOutWrapper,pikeCppInWrapper,@pikeCppOutInGroup,pikeFormat,pikeMlString,pikeCommentStartError,@pikeBadGroup,pikeWord | |
281 syn region pikeDefine start="^\s*\zs#\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend contains=@pikeStmt,@pikeBadGroup | |
282 syn region pikePreProc start="^\s*\zs#\s*\%(pragma\|charset\|pike\|require\|string\|line\|warning\|error\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix,@Spell,pikeConstant | |
283 | |
284 syn match pikeAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@pikeAutodoc containedin=pikeComment,pikeCommentL | |
285 syn cluster pikeCommentGroup add=pikeAutodocReal | |
286 syn cluster pikePreProcGroup add=pikeAutodocReal | |
7 | 287 |
288 " Highlight User Labels | |
289 " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' | |
13125 | 290 syn match pikeUserLabel display "\%(^\|[{};]\)\zs\I\i*\s*\ze:\%([^:]\|$\)" contained contains=NONE |
291 syn match pikeUserLabel display "\%(\<\%(break\|continue\)\_s\+\)\@10<=\I\i*" contained contains=NONE | |
292 syn match pikeUserLabel display "\%(\<case\)\@5<=\s\+[^<()[\]{},;:]\+\ze::\@!" contained contains=pikeDelimiterDQ,pikeDelimiterSQ | |
293 | |
294 syn match pikeMappIndex display contained "[^<()[\]{},;:]\+\ze::\@!" contains=pikeDelimiterDQ,pikeDelimiterSQ | |
295 syn match pikeSoftCast display contained "\[[ \t\v\r\n.a-zA-Z0-9_():,|\+]" contains=NONE | |
7 | 296 |
13125 | 297 if exists("c_minlines") |
298 let b:c_minlines = c_minlines | |
299 else | |
300 if !exists("c_no_if0") | |
301 let b:c_minlines = 400 " #if 0 constructs can be long | |
302 else | |
303 let b:c_minlines = 200 " mostly for multiline strings | |
304 endif | |
305 endif | |
306 exec "syn sync ccomment pikeComment minlines=" . b:c_minlines | |
307 syn sync match pikeMlStringSync grouphere pikeMlString +^[^"#]\+#\"+ | |
308 syn sync match pikeAutodocSync grouphere pikeCommentL "^\s*//!" | |
7 | 309 |
310 " Define the default highlighting. | |
13125 | 311 " Only used when an item doesn't have highlighting yet |
312 hi def link pikeFormat SpecialChar | |
313 hi def link pikeMlString String | |
314 hi def link pikeCommentL Comment | |
315 hi def link pikeCommentStart Comment | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
316 hi def link pikeLabel Label |
13125 | 317 hi def link pikeUserLabel Identifier |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
318 hi def link pikeConditional Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
319 hi def link pikeRepeat Repeat |
13125 | 320 hi def link pikeCharacter Character |
321 hi def link pikeDelimiterDQ Delimiter | |
322 hi def link pikeDelimiterSQ Delimiter | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
323 hi def link pikeNumber Number |
13125 | 324 hi def link pikeOctal Number |
325 hi def link pikeOctalZero PreProc " link this to Error if you want | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
326 hi def link pikeFloat Float |
13125 | 327 hi def link pikeOctalError Error |
328 hi def link pikeCommentError Error | |
329 hi def link pikeCommentStartError Error | |
330 hi def link pikeSpaceError Error | |
331 hi def link pikeSpecialError Error | |
332 hi def link pikeOperator Operator | |
333 hi def link pikeCppOperator Operator | |
334 hi def link pikeStructure Structure | |
335 hi def link pikeTypedef Typedef | |
336 hi def link pikeStorageClass StorageClass | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
337 hi def link pikeInclude Include |
13125 | 338 hi def link pikeCppPrefix PreCondit |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
339 hi def link pikePreProc PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
340 hi def link pikeDefine Macro |
13125 | 341 hi def link pikeIncluded String |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
342 hi def link pikeError Error |
13125 | 343 hi def link pikeDebug Debug |
344 hi def link pikeException Exception | |
345 hi def link pikeStatement Statement | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
346 hi def link pikeType Type |
13125 | 347 hi def link pikeConstant Constant |
348 hi def link pikeBoolean Boolean | |
349 hi def link pikeCommentString String | |
350 hi def link pikeComment2String String | |
351 hi def link pikeCommentSkip Comment | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
352 hi def link pikeString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
353 hi def link pikeComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
354 hi def link pikeSpecial SpecialChar |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
355 hi def link pikeTodo Todo |
13125 | 356 hi def link pikeBadContinuation Error |
357 | |
358 hi def link pikeCppInWrapper PreCondit | |
359 hi def link pikeCppOutWrapper PreCondit | |
360 hi def link pikePreConditMatch PreCondit | |
361 | |
362 hi def link pikeCppOutSkip Comment | |
363 hi def link pikeCppInElse2 Comment | |
364 hi def link pikeCppOutIf2 Comment | |
365 hi def link pikeCppOut Comment | |
7 | 366 |
13125 | 367 hi def link pikePredef Statement |
368 hi def link pikeBindings Identifier | |
369 hi def link pikeMappIndex Identifier | |
370 hi def link pikeSoftCast Type | |
371 hi def link pikeBadGroup Error | |
372 hi def link pikeBadPClose Error | |
373 hi def link pikeBadAClose Error | |
374 hi def link pikeBadBClose Error | |
375 hi def link pikeBadSPClose Error | |
376 hi def link pikeBadSAClose Error | |
377 hi def link pikeBadSBClose Error | |
378 hi def link pikeBadSPAClose Error | |
379 hi def link pikeBadSBAClose Error | |
380 hi def link pikeBadSClose Error | |
7 | 381 |
382 let b:current_syntax = "pike" | |
383 | |
13125 | 384 let &cpo = s:cpo_save |
385 unlet s:cpo_save | |
7 | 386 " vim: ts=8 |