Mercurial > vim
annotate runtime/syntax/lpc.vim @ 23910:6cfb5e0231e0
Added tag v8.2.2497 for changeset 5db7d275543cc109d67231ed733e1e596ab689fc
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 Feb 2021 22:30:07 +0100 |
parents | 46763b01cd9a |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: LPC | |
3 " Maintainer: Shizhu Pan <poet@mudbuilder.net> | |
4 " URL: http://poet.tomud.com/pub/lpc.vim.bz2 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
5 " Last Change: 2016 Aug 31 |
7 | 6 " Comments: If you are using Vim 6.2 or later, see :h lpc.vim for |
7 " file type recognizing, if not, you had to use modeline. | |
8 | |
9 | |
10 " Nodule: This is the start nodule. {{{1 | |
11 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
12 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
13 if exists("b:current_syntax") |
7 | 14 finish |
15 endif | |
16 | |
3224 | 17 let s:cpo_save = &cpo |
18 set cpo&vim | |
19 | |
7 | 20 " Nodule: Keywords {{{1 |
21 | |
22 " LPC keywords | |
23 " keywords should always be highlighted so "contained" is not used. | |
24 syn cluster lpcKeywdGrp contains=lpcConditional,lpcLabel,lpcOperator,lpcRepeat,lpcStatement,lpcModifier,lpcReserved | |
25 | |
26 syn keyword lpcConditional if else switch | |
27 syn keyword lpcLabel case default | |
28 syn keyword lpcOperator catch efun in inherit | |
29 syn keyword lpcRepeat do for foreach while | |
30 syn keyword lpcStatement break continue return | |
31 | |
32 syn match lpcEfunError /efun[^:]/ display | |
33 | |
34 " Illegal to use keyword as function | |
35 " It's not working, maybe in the next version. | |
36 syn keyword lpcKeywdError contained if for foreach return switch while | |
37 | |
38 " These are keywords only because they take lvalue or type as parameter, | |
39 " so these keywords should only be used as function but cannot be names of | |
40 " user-defined functions. | |
41 syn keyword lpcKeywdFunc new parse_command sscanf time_expression | |
42 | |
43 " Nodule: Type and modifiers {{{1 | |
44 | |
45 " Type names list. | |
46 | |
47 " Special types | |
48 syn keyword lpcType void mixed unknown | |
49 " Scalar/Value types. | |
50 syn keyword lpcType int float string | |
51 " Pointer types. | |
52 syn keyword lpcType array buffer class function mapping object | |
53 " Other types. | |
54 if exists("lpc_compat_32") | |
55 syn keyword lpcType closure status funcall | |
56 else | |
57 syn keyword lpcError closure status | |
58 syn keyword lpcType multiset | |
59 endif | |
60 | |
61 " Type modifier. | |
62 syn keyword lpcModifier nomask private public | |
63 syn keyword lpcModifier varargs virtual | |
64 | |
65 " sensible modifiers | |
66 if exists("lpc_pre_v22") | |
67 syn keyword lpcReserved nosave protected ref | |
68 syn keyword lpcModifier static | |
69 else | |
70 syn keyword lpcError static | |
71 syn keyword lpcModifier nosave protected ref | |
72 endif | |
73 | |
74 " Nodule: Applies {{{1 | |
75 | |
76 " Match a function declaration or function pointer | |
77 syn match lpcApplyDecl excludenl /->\h\w*(/me=e-1 contains=lpcApplies transparent display | |
78 | |
79 " We should note that in func_spec.c the efun definition syntax is so | |
80 " complicated that I use such a long regular expression to describe. | |
81 syn match lpcLongDecl excludenl /\(\s\|\*\)\h\+\s\h\+(/me=e-1 contains=@lpcEfunGroup,lpcType,@lpcKeywdGrp transparent display | |
82 | |
83 " this is form for all functions | |
84 " ->foo() form had been excluded | |
85 syn match lpcFuncDecl excludenl /\h\w*(/me=e-1 contains=lpcApplies,@lpcEfunGroup,lpcKeywdError transparent display | |
86 | |
87 " The (: :) parenthesis or $() forms a function pointer | |
88 syn match lpcFuncName /(:\s*\h\+\s*:)/me=e-1 contains=lpcApplies,@lpcEfunGroup transparent display contained | |
89 syn match lpcFuncName /(:\s*\h\+,/ contains=lpcApplies,@lpcEfunGroup transparent display contained | |
90 syn match lpcFuncName /\$(\h\+)/ contains=lpcApplies,@lpcEfunGroup transparent display contained | |
91 | |
92 " Applies list. | |
93 " system applies | |
94 syn keyword lpcApplies contained __INIT clean_up create destructor heart_beat id init move_or_destruct reset | |
95 " interactive | |
96 syn keyword lpcApplies contained catch_tell logon net_dead process_input receive_message receive_snoop telnet_suboption terminal_type window_size write_prompt | |
97 " master applies | |
98 syn keyword lpcApplies contained author_file compile_object connect crash creator_file domain_file epilog error_handler flag get_bb_uid get_root_uid get_save_file_name log_error make_path_absolute object_name preload privs_file retrieve_ed_setup save_ed_setup slow_shutdown | |
99 syn keyword lpcApplies contained valid_asm valid_bind valid_compile_to_c valid_database valid_hide valid_link valid_object valid_override valid_read valid_save_binary valid_seteuid valid_shadow valid_socket valid_write | |
100 " parsing | |
101 syn keyword lpcApplies contained inventory_accessible inventory_visible is_living parse_command_adjectiv_id_list parse_command_adjective_id_list parse_command_all_word parse_command_id_list parse_command_plural_id_list parse_command_prepos_list parse_command_users parse_get_environment parse_get_first_inventory parse_get_next_inventory parser_error_message | |
102 | |
103 | |
104 " Nodule: Efuns {{{1 | |
105 | |
106 syn cluster lpcEfunGroup contains=lpc_efuns,lpcOldEfuns,lpcNewEfuns,lpcKeywdFunc | |
107 | |
108 " Compat32 efuns | |
109 if exists("lpc_compat_32") | |
110 syn keyword lpc_efuns contained closurep heart_beat_info m_delete m_values m_indices query_once_interactive strstr | |
111 else | |
112 syn match lpcErrFunc /#`\h\w*/ | |
113 " Shell compatible first line comment. | |
114 syn region lpcCommentFunc start=/^#!/ end=/$/ | |
115 endif | |
116 | |
117 " pre-v22 efuns which are removed in newer versions. | |
118 syn keyword lpcOldEfuns contained tail dump_socket_status | |
119 | |
120 " new efuns after v22 should be added here! | |
121 syn keyword lpcNewEfuns contained socket_status | |
122 | |
123 " LPC efuns list. | |
124 " DEBUG efuns Not included. | |
125 " New efuns should NOT be added to this list, see v22 efuns above. | |
126 " Efuns list {{{2 | |
127 syn keyword lpc_efuns contained acos add_action all_inventory all_previous_objects allocate allocate_buffer allocate_mapping apply arrayp asin atan author_stats | |
128 syn keyword lpc_efuns contained bind break_string bufferp | |
129 syn keyword lpc_efuns contained cache_stats call_other call_out call_out_info call_stack capitalize catch ceil check_memory children classp clear_bit clone_object clonep command commands copy cos cp crc32 crypt ctime | |
130 syn keyword lpc_efuns contained db_close db_commit db_connect db_exec db_fetch db_rollback db_status debug_info debugmalloc debug_message deep_inherit_list deep_inventory destruct disable_commands disable_wizard domain_stats dumpallobj dump_file_descriptors dump_prog | |
131 syn keyword lpc_efuns contained each ed ed_cmd ed_start enable_commands enable_wizard environment error errorp eval_cost evaluate exec exp explode export_uid external_start | |
132 syn keyword lpc_efuns contained fetch_variable file_length file_name file_size filter filter_array filter_mapping find_call_out find_living find_object find_player first_inventory floatp floor flush_messages function_exists function_owner function_profile functionp functions | |
133 syn keyword lpc_efuns contained generate_source get_char get_config get_dir geteuid getuid | |
134 syn keyword lpc_efuns contained heart_beats | |
135 syn keyword lpc_efuns contained id_matrix implode in_edit in_input inherit_list inherits input_to interactive intp | |
136 syn keyword lpc_efuns contained keys | |
137 syn keyword lpc_efuns contained link living livings load_object localtime log log10 lookat_rotate lower_case lpc_info | |
138 syn keyword lpc_efuns contained malloc_check malloc_debug malloc_status map map_array map_delete map_mapping mapp master match_path max_eval_cost member_array memory_info memory_summary message mkdir moncontrol move_object mud_status | |
139 syn keyword lpc_efuns contained named_livings network_stats next_bit next_inventory notify_fail nullp | |
140 syn keyword lpc_efuns contained objectp objects oldcrypt opcprof origin | |
141 syn keyword lpc_efuns contained parse_add_rule parse_add_synonym parse_command parse_dump parse_init parse_my_rules parse_refresh parse_remove parse_sentence pluralize pointerp pow present previous_object printf process_string process_value program_info | |
142 syn keyword lpc_efuns contained query_ed_mode query_heart_beat query_host_name query_idle query_ip_name query_ip_number query_ip_port query_load_average query_notify_fail query_privs query_replaced_program query_shadowing query_snoop query_snooping query_verb | |
143 syn keyword lpc_efuns contained random read_buffer read_bytes read_file receive reclaim_objects refs regexp reg_assoc reload_object remove_action remove_call_out remove_interactive remove_shadow rename repeat_string replace_program replace_string replaceable reset_eval_cost resolve restore_object restore_variable rm rmdir rotate_x rotate_y rotate_z rusage | |
144 syn keyword lpc_efuns contained save_object save_variable say scale set_author set_bit set_eval_limit set_heart_beat set_hide set_light set_living_name set_malloc_mask set_privs set_reset set_this_player set_this_user seteuid shadow shallow_inherit_list shout shutdown sin sizeof snoop socket_accept socket_acquire socket_address socket_bind socket_close socket_connect socket_create socket_error socket_listen socket_release socket_write sort_array sprintf sqrt stat store_variable strcmp stringp strlen strsrch | |
145 syn keyword lpc_efuns contained tan tell_object tell_room terminal_colour test_bit this_interactive this_object this_player this_user throw time to_float to_int trace traceprefix translate typeof | |
146 syn keyword lpc_efuns contained undefinedp unique_array unique_mapping upper_case uptime userp users | |
147 syn keyword lpc_efuns contained values variables virtualp | |
148 syn keyword lpc_efuns contained wizardp write write_buffer write_bytes write_file | |
149 | |
150 " Nodule: Constants {{{1 | |
151 | |
152 " LPC Constants. | |
153 " like keywords, constants are always highlighted, be careful to choose only | |
154 " the constants we used to add to this list. | |
155 syn keyword lpcConstant __ARCH__ __COMPILER__ __DIR__ __FILE__ __OPTIMIZATION__ __PORT__ __VERSION__ | |
156 " Defines in options.h are all predefined in LPC sources surrounding by | |
157 " two underscores. Do we need to include all of that? | |
158 syn keyword lpcConstant __SAVE_EXTENSION__ __HEARTBEAT_INTERVAL__ | |
159 " from the documentation we know that these constants remains only for | |
160 " backward compatibility and should not be used any more. | |
161 syn keyword lpcConstant HAS_ED HAS_PRINTF HAS_RUSAGE HAS_DEBUG_LEVEL | |
162 syn keyword lpcConstant MUD_NAME F__THIS_OBJECT | |
163 | |
164 " Nodule: Todo for this file. {{{1 | |
165 | |
166 " TODO : need to check for LPC4 syntax and other series of LPC besides | |
167 " v22, b21 and l32, if you had a good idea, contact me at poet@mudbuilder.net | |
168 " and I will be appreciated about that. | |
169 | |
170 " Notes about some FAQ: | |
171 " | |
172 " About variables : We adopts the same behavior for C because almost all the | |
173 " LPC programmers are also C programmers, so we don't need separate settings | |
174 " for C and LPC. That is the reason why I don't change variables like | |
175 " "c_no_utf"s to "lpc_no_utf"s. | |
176 " | |
177 " Copy : Some of the following seems to be copied from c.vim but not quite | |
178 " the same in details because the syntax for C and LPC is different. | |
179 " | |
180 " Color scheme : this syntax file had been thouroughly tested to work well | |
181 " for all of the dark-backgrounded color schemes Vim has provided officially, | |
182 " and it should be quite Ok for all of the bright-backgrounded color schemes, | |
183 " of course it works best for the color scheme that I am using, download it | |
184 " from http://poet.tomud.com/pub/ps_color.vim.bz2 if you want to try it. | |
185 " | |
186 | |
187 " Nodule: String and Character {{{1 | |
188 | |
189 | |
190 " String and Character constants | |
191 " Highlight special characters (those which have a backslash) differently | |
192 syn match lpcSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" | |
193 if !exists("c_no_utf") | |
194 syn match lpcSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)" | |
195 endif | |
196 | |
197 " LPC version of sprintf() format, | |
198 syn match lpcFormat display "%\(\d\+\)\=[-+ |=#@:.]*\(\d\+\)\=\('\I\+'\|'\I*\\'\I*'\)\=[OsdicoxXf]" contained | |
199 syn match lpcFormat display "%%" contained | |
200 syn region lpcString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=lpcSpecial,lpcFormat | |
201 " lpcCppString: same as lpcString, but ends at end of line | |
202 syn region lpcCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=lpcSpecial,lpcFormat | |
203 | |
204 " LPC preprocessor for the text formatting short cuts | |
205 " Thanks to Dr. Charles E. Campbell <cec@gryphon.gsfc.nasa.gov> | |
206 " he suggests the best way to do this. | |
207 syn region lpcTextString start=/@\z(\h\w*\)$/ end=/^\z1/ contains=lpcSpecial | |
208 syn region lpcArrayString start=/@@\z(\h\w*\)$/ end=/^\z1/ contains=lpcSpecial | |
209 | |
210 " Character | |
211 syn match lpcCharacter "L\='[^\\]'" | |
212 syn match lpcCharacter "L'[^']*'" contains=lpcSpecial | |
213 syn match lpcSpecialError "L\='\\[^'\"?\\abefnrtv]'" | |
214 syn match lpcSpecialCharacter "L\='\\['\"?\\abefnrtv]'" | |
215 syn match lpcSpecialCharacter display "L\='\\\o\{1,3}'" | |
216 syn match lpcSpecialCharacter display "'\\x\x\{1,2}'" | |
217 syn match lpcSpecialCharacter display "L'\\x\x\+'" | |
218 | |
219 " Nodule: White space {{{1 | |
220 | |
221 " when wanted, highlight trailing white space | |
222 if exists("c_space_errors") | |
223 if !exists("c_no_trail_space_error") | |
224 syn match lpcSpaceError display excludenl "\s\+$" | |
225 endif | |
226 if !exists("c_no_tab_space_error") | |
227 syn match lpcSpaceError display " \+\t"me=e-1 | |
228 endif | |
229 endif | |
230 | |
231 " Nodule: Parenthesis and brackets {{{1 | |
232 | |
233 " catch errors caused by wrong parenthesis and brackets | |
234 syn cluster lpcParenGroup contains=lpcParenError,lpcIncluded,lpcSpecial,lpcCommentSkip,lpcCommentString,lpcComment2String,@lpcCommentGroup,lpcCommentStartError,lpcUserCont,lpcUserLabel,lpcBitField,lpcCommentSkip,lpcOctalZero,lpcCppOut,lpcCppOut2,lpcCppSkip,lpcFormat,lpcNumber,lpcFloat,lpcOctal,lpcOctalError,lpcNumbersCom | |
235 syn region lpcParen transparent start='(' end=')' contains=ALLBUT,@lpcParenGroup,lpcCppParen,lpcErrInBracket,lpcCppBracket,lpcCppString,@lpcEfunGroup,lpcApplies,lpcKeywdError | |
236 " lpcCppParen: same as lpcParen but ends at end-of-line; used in lpcDefine | |
237 syn region lpcCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@lpcParenGroup,lpcErrInBracket,lpcParen,lpcBracket,lpcString,@lpcEfunGroup,lpcApplies,lpcKeywdError | |
238 syn match lpcParenError display ")" | |
239 syn match lpcParenError display "\]" | |
240 " for LPC: | |
241 " Here we should consider the array ({ }) parenthesis and mapping ([ ]) | |
242 " parenthesis and multiset (< >) parenthesis. | |
243 syn match lpcErrInParen display contained "[^^]{"ms=s+1 | |
244 syn match lpcErrInParen display contained "\(}\|\]\)[^)]"me=e-1 | |
245 syn region lpcBracket transparent start='\[' end=']' contains=ALLBUT,@lpcParenGroup,lpcErrInParen,lpcCppParen,lpcCppBracket,lpcCppString,@lpcEfunGroup,lpcApplies,lpcFuncName,lpcKeywdError | |
246 " lpcCppBracket: same as lpcParen but ends at end-of-line; used in lpcDefine | |
247 syn region lpcCppBracket transparent start='\[' skip='\\$' excludenl end=']' end='$' contained contains=ALLBUT,@lpcParenGroup,lpcErrInParen,lpcParen,lpcBracket,lpcString,@lpcEfunGroup,lpcApplies,lpcFuncName,lpcKeywdError | |
248 syn match lpcErrInBracket display contained "[);{}]" | |
249 | |
250 " Nodule: Numbers {{{1 | |
251 | |
252 " integer number, or floating point number without a dot and with "f". | |
253 syn case ignore | |
254 syn match lpcNumbers display transparent "\<\d\|\.\d" contains=lpcNumber,lpcFloat,lpcOctalError,lpcOctal | |
255 " Same, but without octal error (for comments) | |
256 syn match lpcNumbersCom display contained transparent "\<\d\|\.\d" contains=lpcNumber,lpcFloat,lpcOctal | |
257 syn match lpcNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" | |
258 " hex number | |
259 syn match lpcNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" | |
260 " Flag the first zero of an octal number as something special | |
261 syn match lpcOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=lpcOctalZero | |
262 syn match lpcOctalZero display contained "\<0" | |
263 syn match lpcFloat display contained "\d\+f" | |
264 " floating point number, with dot, optional exponent | |
265 syn match lpcFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" | |
266 " floating point number, starting with a dot, optional exponent | |
267 syn match lpcFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" | |
268 " floating point number, without dot, with exponent | |
269 syn match lpcFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>" | |
270 " flag an octal number with wrong digits | |
271 syn match lpcOctalError display contained "0\o*[89]\d*" | |
272 syn case match | |
273 | |
274 " Nodule: Comment string {{{1 | |
275 | |
276 " lpcCommentGroup allows adding matches for special things in comments | |
277 syn keyword lpcTodo contained TODO FIXME XXX | |
278 syn cluster lpcCommentGroup contains=lpcTodo | |
279 | |
280 if exists("c_comment_strings") | |
281 " A comment can contain lpcString, lpcCharacter and lpcNumber. | |
282 syntax match lpcCommentSkip contained "^\s*\*\($\|\s\+\)" | |
283 syntax region lpcCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=lpcSpecial,lpcCommentSkip | |
284 syntax region lpcComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=lpcSpecial | |
285 syntax region lpcCommentL start="//" skip="\\$" end="$" keepend contains=@lpcCommentGroup,lpcComment2String,lpcCharacter,lpcNumbersCom,lpcSpaceError | |
286 syntax region lpcComment matchgroup=lpcCommentStart start="/\*" matchgroup=NONE end="\*/" contains=@lpcCommentGroup,lpcCommentStartError,lpcCommentString,lpcCharacter,lpcNumbersCom,lpcSpaceError | |
287 else | |
288 syn region lpcCommentL start="//" skip="\\$" end="$" keepend contains=@lpcCommentGroup,lpcSpaceError | |
289 syn region lpcComment matchgroup=lpcCommentStart start="/\*" matchgroup=NONE end="\*/" contains=@lpcCommentGroup,lpcCommentStartError,lpcSpaceError | |
290 endif | |
291 " keep a // comment separately, it terminates a preproc. conditional | |
292 syntax match lpcCommentError display "\*/" | |
293 syntax match lpcCommentStartError display "/\*"me=e-1 contained | |
294 | |
295 " Nodule: Pre-processor {{{1 | |
296 | |
297 syn region lpcPreCondit start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=lpcComment,lpcCppString,lpcCharacter,lpcCppParen,lpcParenError,lpcNumbers,lpcCommentError,lpcSpaceError | |
298 syn match lpcPreCondit display "^\s*#\s*\(else\|endif\)\>" | |
299 if !exists("c_no_if0") | |
300 syn region lpcCppOut start="^\s*#\s*if\s\+0\+\>" end=".\|$" contains=lpcCppOut2 | |
301 syn region lpcCppOut2 contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=lpcSpaceError,lpcCppSkip | |
302 syn region lpcCppSkip contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=lpcSpaceError,lpcCppSkip | |
303 endif | |
304 syn region lpcIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
305 syn match lpcIncluded display contained "<[^>]*>" | |
306 syn match lpcInclude display "^\s*#\s*include\>\s*["<]" contains=lpcIncluded | |
307 syn match lpcLineSkip "\\$" | |
308 syn cluster lpcPreProcGroup contains=lpcPreCondit,lpcIncluded,lpcInclude,lpcDefine,lpcErrInParen,lpcErrInBracket,lpcUserLabel,lpcSpecial,lpcOctalZero,lpcCppOut,lpcCppOut2,lpcCppSkip,lpcFormat,lpcNumber,lpcFloat,lpcOctal,lpcOctalError,lpcNumbersCom,lpcString,lpcCommentSkip,lpcCommentString,lpcComment2String,@lpcCommentGroup,lpcCommentStartError,lpcParen,lpcBracket,lpcMulti,lpcKeywdError | |
309 syn region lpcDefine start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 contains=ALLBUT,@lpcPreProcGroup | |
310 | |
311 if exists("lpc_pre_v22") | |
312 syn region lpcPreProc start="^\s*#\s*\(pragma\>\|echo\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@lpcPreProcGroup | |
313 else | |
314 syn region lpcPreProc start="^\s*#\s*\(pragma\>\|echo\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@lpcPreProcGroup | |
315 endif | |
316 | |
317 " Nodule: User labels {{{1 | |
318 | |
319 " Highlight Labels | |
320 " User labels in LPC is not allowed, only "case x" and "default" is supported | |
321 syn cluster lpcMultiGroup contains=lpcIncluded,lpcSpecial,lpcCommentSkip,lpcCommentString,lpcComment2String,@lpcCommentGroup,lpcCommentStartError,lpcUserCont,lpcUserLabel,lpcBitField,lpcOctalZero,lpcCppOut,lpcCppOut2,lpcCppSkip,lpcFormat,lpcNumber,lpcFloat,lpcOctal,lpcOctalError,lpcNumbersCom,lpcCppParen,lpcCppBracket,lpcCppString,lpcKeywdError | |
322 syn region lpcMulti transparent start='\(case\|default\|public\|protected\|private\)' skip='::' end=':' contains=ALLBUT,@lpcMultiGroup | |
323 | |
324 syn cluster lpcLabelGroup contains=lpcUserLabel | |
325 syn match lpcUserCont display "^\s*lpc:$" contains=@lpcLabelGroup | |
326 | |
327 " Don't want to match anything | |
328 syn match lpcUserLabel display "lpc" contained | |
329 | |
330 " Nodule: Initializations {{{1 | |
331 | |
332 if exists("c_minlines") | |
333 let b:c_minlines = c_minlines | |
334 else | |
335 if !exists("c_no_if0") | |
336 let b:c_minlines = 50 " #if 0 constructs can be long | |
337 else | |
338 let b:c_minlines = 15 " mostly for () constructs | |
339 endif | |
340 endif | |
341 exec "syn sync ccomment lpcComment minlines=" . b:c_minlines | |
342 | |
343 " Make sure these options take place since we no longer depend on file type | |
344 " plugin for C | |
345 setlocal cindent | |
346 setlocal fo-=t fo+=croql | |
347 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// | |
348 | |
349 " Win32 can filter files in the browse dialog | |
350 if has("gui_win32") && !exists("b:browsefilter") | |
351 let b:browsefilter = "LPC Source Files (*.c *.d *.h)\t*.c;*.d;*.h\n" . | |
352 \ "LPC Data Files (*.scr *.o *.dat)\t*.scr;*.o;*.dat\n" . | |
353 \ "Text Documentation (*.txt)\t*.txt\n" . | |
354 \ "All Files (*.*)\t*.*\n" | |
355 endif | |
356 | |
357 " Nodule: Highlight links {{{1 | |
358 | |
359 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
360 " Only when an item doesn't have highlighting yet |
7 | 361 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
362 hi def link lpcModifier lpcStorageClass |
7 | 363 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
364 hi def link lpcQuotedFmt lpcFormat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
365 hi def link lpcFormat lpcSpecial |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
366 hi def link lpcCppString lpcString " Cpp means |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
367 " C Pre-Processor |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
368 hi def link lpcCommentL lpcComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
369 hi def link lpcCommentStart lpcComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
370 hi def link lpcUserLabel lpcLabel |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
371 hi def link lpcSpecialCharacter lpcSpecial |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
372 hi def link lpcOctal lpcPreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
373 hi def link lpcOctalZero lpcSpecial " LPC will treat octal numbers |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
374 " as decimals, programmers should |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
375 " be aware of that. |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
376 hi def link lpcEfunError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
377 hi def link lpcKeywdError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
378 hi def link lpcOctalError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
379 hi def link lpcParenError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
380 hi def link lpcErrInParen lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
381 hi def link lpcErrInBracket lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
382 hi def link lpcCommentError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
383 hi def link lpcCommentStartError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
384 hi def link lpcSpaceError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
385 hi def link lpcSpecialError lpcError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
386 hi def link lpcErrFunc lpcError |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
387 |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
388 if exists("lpc_pre_v22") |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
389 hi def link lpcOldEfuns lpc_efuns |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
390 hi def link lpcNewEfuns lpcError |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
391 else |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
392 hi def link lpcOldEfuns lpcReserved |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
393 hi def link lpcNewEfuns lpc_efuns |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
394 endif |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
395 hi def link lpc_efuns lpcFunction |
7 | 396 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
397 hi def link lpcReserved lpcPreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
398 hi def link lpcTextString lpcString " This should be preprocessors, but |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
399 hi def link lpcArrayString lpcPreProc " let's make some difference |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
400 " between text and array |
7 | 401 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
402 hi def link lpcIncluded lpcString |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
403 hi def link lpcCommentString lpcString |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
404 hi def link lpcComment2String lpcString |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
405 hi def link lpcCommentSkip lpcComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
406 hi def link lpcCommentFunc lpcComment |
7 | 407 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
408 hi def link lpcCppSkip lpcCppOut |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
409 hi def link lpcCppOut2 lpcCppOut |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
410 hi def link lpcCppOut lpcComment |
7 | 411 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3224
diff
changeset
|
412 " Standard type below |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
413 hi def link lpcApplies Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
414 hi def link lpcCharacter Character |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
415 hi def link lpcComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
416 hi def link lpcConditional Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
417 hi def link lpcConstant Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
418 hi def link lpcDefine Macro |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
419 hi def link lpcError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
420 hi def link lpcFloat Float |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
421 hi def link lpcFunction Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
422 hi def link lpcIdentifier Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
423 hi def link lpcInclude Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
424 hi def link lpcLabel Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
425 hi def link lpcNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
426 hi def link lpcOperator Operator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
427 hi def link lpcPreCondit PreCondit |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
428 hi def link lpcPreProc PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
429 hi def link lpcRepeat Repeat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
430 hi def link lpcStatement Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
431 hi def link lpcStorageClass StorageClass |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
432 hi def link lpcString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
433 hi def link lpcStructure Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
434 hi def link lpcSpecial LineNr |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
435 hi def link lpcTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
436 hi def link lpcType Type |
7 | 437 |
438 | |
439 " Nodule: This is the end nodule. {{{1 | |
440 | |
441 let b:current_syntax = "lpc" | |
442 | |
3224 | 443 let &cpo = s:cpo_save |
444 unlet s:cpo_save | |
445 | |
7 | 446 " vim:ts=8:nosta:sw=2:ai:si: |
447 " vim600:set fdm=marker: }}}1 |