Mercurial > vim
annotate runtime/syntax/krl.vim @ 33399:95db67c7b754 v9.0.1958
patch 9.0.1958: cannot complete option values
Commit: https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Fri Sep 29 20:42:32 2023 +0200
patch 9.0.1958: cannot complete option values
Problem: cannot complete option values
Solution: Add completion functions for several options
Add cmdline tab-completion for setting string options
Add tab-completion for setting string options on the cmdline using
`:set=` (along with `:set+=` and `:set-=`).
The existing tab completion for setting options currently only works
when nothing is typed yet, and it only fills in with the existing value,
e.g. when the user does `:set diffopt=<Tab>` it will be completed to
`set diffopt=internal,filler,closeoff` and nothing else. This isn't too
useful as a user usually wants auto-complete to suggest all the possible
values, such as 'iblank', or 'algorithm:patience'.
For set= and set+=, this adds a new optional callback function for each
option that can be invoked when doing completion. This allows for each
option to have control over how completion works. For example, in
'diffopt', it will suggest the default enumeration, but if `algorithm:`
is selected, it will further suggest different algorithm types like
'meyers' and 'patience'. When using set=, the existing option value will
be filled in as the first choice to preserve the existing behavior. When
using set+= this won't happen as it doesn't make sense.
For flag list options (e.g. 'mouse' and 'guioptions'), completion will
take into account existing typed values (and in the case of set+=, the
existing option value) to make sure it doesn't suggest duplicates.
For set-=, there is a new `ExpandSettingSubtract` function which will
handle flag list and comma-separated options smartly, by only suggesting
values that currently exist in the option.
Note that Vim has some existing code that adds special handling for
'filetype', 'syntax', and misc dir options like 'backupdir'. This change
preserves them as they already work, instead of converting to the new
callback API for each option.
closes: #13182
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 29 Sep 2023 20:45:04 +0200 |
parents | 3dd63e73de28 |
children |
rev | line source |
---|---|
28517 | 1 " Vim syntax file |
2 " Language: Kuka Robot Language | |
3 " Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de> | |
4 " Version: 3.0.0 | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
5 " Last Change: 22. Jun 2023 |
28517 | 6 " Credits: Thanks for contributions to this to Michael Jagusch |
7 " Thanks for beta testing to Thomas Baginski | |
8 " | |
9 " Note to self: | |
10 " for testing perfomance | |
11 " open a 1000 lines file. | |
12 " :syntime on | |
13 " G | |
14 " hold down CTRL-U until reaching top | |
15 " :syntime report | |
16 | |
17 " Init {{{ | |
18 if exists("b:current_syntax") | |
19 finish | |
20 endif | |
21 | |
22 let s:keepcpo = &cpo | |
23 set cpo&vim | |
24 | |
25 " if colorscheme is tortus(less)? krlGroupName defaults to 1 | |
26 if get(g:, 'colors_name', " ") =~ '\<tortus' | |
27 \&& !exists("g:krlGroupName") | |
28 let g:krlGroupName=1 | |
29 endif | |
30 " krlGroupName defaults to 0 if it's not initialized yet or 0 | |
31 if !get(g:, "krlGroupName", 0) | |
32 let g:krlGroupName = 0 | |
33 endif | |
34 | |
35 " krl does ignore case | |
36 syn case ignore | |
37 " take #, $ and & into keyword (syntax only) | |
38 syn iskeyword @,48-57,_,192-255,#,$,& | |
39 " spell checking | |
40 syn spell notoplevel | |
41 " }}} init | |
42 | |
43 " Comment and Folding {{{ | |
44 | |
45 " Special Comment | |
46 | |
47 " TODO Comment | |
48 syn keyword krlTodo contained TODO FIXME XXX | |
49 highlight default link krlTodo Todo | |
50 | |
51 " Debug Comment | |
52 syn keyword krlDebug contained DEBUG | |
53 highlight default link krlDebug Debug | |
54 | |
55 " Comment | |
56 " none move fold comment until second ; | |
57 syn match krlFoldComment /\c\v^\s*;\s*%(end)?fold>[^;]*/ containedin=krlFold contains=krlSingleQuoteString,krlInteger,krlFloat,krlMovement,krlDelimiter,krlBoolean | |
58 highlight default link krlFoldComment Comment | |
59 | |
60 " move fold comment until second ; | |
61 syn match krlMoveFoldComment /\c\v^\s*;\s*fold>[^;]*<s?%(ptp|lin|circ|spl)(_rel)?>[^;]*/ containedin=krlFold contains=krlInteger,krlFloat,krlMovement,krlDelimiter | |
62 highlight default link krlMoveFoldComment Comment | |
63 | |
64 " things to highlight in a fold line | |
65 syn keyword krlFoldHighlights CONT IN SYN OUT containedin=krlFoldComment | |
66 syn match krlFoldHighlights /\c\v<(M|F|E|A|t|i|bin|binin|UP|SPSMAKRO)\d+>/ containedin=krlFoldComment | |
67 if g:krlGroupName | |
68 highlight default link krlFoldHighlights Sysvars | |
69 else | |
70 " default color for Fold Highlights | |
71 endif | |
72 syn keyword krlVkrcFoldConstants EIN AUS containedin=krlFoldComment | |
73 highlight default link krlVkrcFoldConstants Boolean | |
74 | |
75 " Comment without Fold, also includes endfold lines and fold line part after second ; | |
76 syn match krlComment /\c\v;\s*%(<%(end)?fold>)@!.*$/ containedin=krlFold contains=krlTodo,krlDebug,@Spell | |
77 " Commented out Fold line: "; ;FOLD PTP..." | |
78 syn match krlComment /\c\v^\s*;\s*;.*$/ contains=krlTodo,krlDebug | |
79 highlight default link krlComment Comment | |
80 | |
81 if has("conceal") && get(g:, 'krlConcealFoldTail', 1) | |
82 syn match krlConcealFoldTail /\c\v(^\s*;\s*fold[^;]*)@250<=;%(--|\s*<fold>|\s*<endfold>)@!.*$/ transparent containedin=krlComment conceal cchar=* | |
83 endif | |
84 " }}} Comment and Folding | |
85 | |
86 " Header {{{ | |
87 syn match krlHeader /&\a\w*/ | |
88 highlight default link krlHeader PreProc | |
89 " }}} Header | |
90 | |
91 " Operator {{{ | |
92 " Boolean operator | |
93 syn keyword krlBoolOperator and or exor not b_and b_or b_exor b_not | |
94 highlight default link krlBoolOperator Operator | |
95 " Arithmetic operator | |
96 syn match krlArithOperator /[+-]/ containedin=krlFloat | |
97 syn match krlArithOperator /[*/]/ | |
98 highlight default link krlArithOperator Operator | |
99 " Compare operator | |
100 syn match krlCompOperator /[<>=]/ | |
101 highlight default link krlCompOperator Operator | |
102 " Geometric operator | |
103 " Do not move the : operator | |
104 " Must be present befor krlParamdef | |
105 syn match krlGeomOperator /[:]/ | |
106 " syn match krlGeomOperator /[:]/ containedin=krlLabel,krlParamdef | |
107 highlight default link krlGeomOperator Operator | |
108 " }}} Operator | |
109 | |
110 " Type, StorageClass and Typedef {{{ | |
111 " Simple data types | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
112 syn keyword krlType bool char real int |
28517 | 113 " External program and function |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
114 syn keyword krlType ext extfct extfctp extp |
28517 | 115 " Communication |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
116 syn keyword krlType signal channel |
28517 | 117 highlight default link krlType Type |
118 " StorageClass | |
119 syn keyword krlStorageClass decl global const struc enum | |
120 highlight default link krlStorageClass StorageClass | |
121 " .dat file public | |
122 syn keyword krlDatStorageClass public | |
123 highlight default link krlDatStorageClass StorageClass | |
124 " Parameter StorageClass | |
125 " Do not move the :in/:out | |
126 " Must be present after krlGeomOperator | |
127 syn match krlParamdef /[:]\s*in\>/ | |
128 syn match krlParamdef /[:]\s*out\>/ | |
129 highlight default link krlParamdef StorageClass | |
130 " Not a typedef but I like to have those highlighted | |
131 " different then types, structures or strorage classes | |
132 syn keyword krlTypedef DEF DEFFCT ENDFCT DEFDAT ENDDAT | |
133 syn match krlTypedef /^\s*END\>/ | |
134 highlight default link krlTypedef Typedef | |
135 " }}} Type, StorageClass and Typedef | |
136 | |
137 " Delimiter {{{ | |
138 syn match krlDelimiter /[\[\](),\\]/ | |
139 highlight default link krlDelimiter Delimiter | |
140 " }}} Delimiter | |
141 | |
142 " Constant values {{{ | |
143 " Boolean | |
144 syn keyword krlBoolean true false containedin=krlStructVal | |
145 highlight default link krlBoolean Boolean | |
146 " Binary integer | |
147 syn match krlBinaryInt /'b[01]\+'/ containedin=krlStructVal | |
148 highlight default link krlBinaryInt Number | |
149 " Hexadecimal integer | |
150 syn match krlHexInt /'h[0-9a-fA-F]\+'/ containedin=krlStructVal | |
151 highlight default link krlHexInt Number | |
152 " Integer | |
153 syn match krlInteger /\W\@1<=[+-]\?\d\+/ containedin=krlStructVal,krlFloat contains=krlArithOperator | |
154 highlight default link krlInteger Number | |
155 " Float | |
156 syn match krlFloat /\v\W@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ containedin=krlStructVal | |
157 highlight default link krlFloat Float | |
158 " String | |
159 syn region krlString start=/"/ end=/"/ oneline containedin=krlStructVal contains=@Spell | |
160 highlight default link krlString String | |
161 syn match krlSpecialChar /[|]/ containedin=krlString | |
162 highlight default link krlSpecialChar SpecialChar | |
163 " String within a fold line | |
164 syn region krlSingleQuoteString start=/'/ end=/'/ oneline contained contains=@Spell | |
165 highlight default link krlSingleQuoteString String | |
166 " Enum | |
167 syn match krlEnumVal /#\s*\a\w*/ containedin=krlStructVal | |
168 highlight default link krlEnumVal Constant | |
169 " }}} Constant values | |
170 | |
171 " Predefined Structure and Enum {{{ | |
172 " Predefined structures and enums found in | |
173 " /r1/mada/$*.dat, /r1/steu/$*.dat and | |
174 " /r1/system/$config.dat as well as | |
175 " basisTech, gripperTech and spotTech | |
176 " | |
177 " Predefined data types found in krc1 | |
178 syn keyword krlStructure servopara keymove powermodul trace techangle tech techfct techcps techfctctrl axis_inc axis_cal date display_var pro_ip con bus | |
179 syn keyword krlEnum ident_state sig_state move_state async_state emt_mode boxmode msg_prm_typ msg_typ cmd_stat asys trace_state trace_mode direction techsys techgeoref techclass techmode hpu_key_val pro_state eax transsys mode_move cosys device rotsys emstop cause_t | |
180 " | |
181 " Predefined data types found in kss functions | |
182 syn keyword krlEnum ediagstate rdc_fs_state ret_c_psync_e var_type cancel_psync_e sys_vars | |
183 syn keyword krlStructure siginf rw_rdc_file rw_mam_file diagpar_t error_t stopmess case_sense_t msgbuf_t e3pos e3axis diagopt_t | |
184 " | |
185 " Predefined structures for movement | |
186 syn keyword krlStructure frame e6pos pos e6axis axis | |
187 syn keyword krlStructure fdat ldat pdat | |
188 syn keyword krlStructure load inertia | |
189 " | |
190 " Predefined structures for shapes | |
191 syn keyword krlStructure axbox cylinder box | |
192 " | |
193 " Predefined structures and enums found in /r1/mada/$machine.dat | |
194 syn keyword krlStructure cp fra acc_car jerk_struc dhart spin trpspin ex_kin et_ax maxtool | |
195 syn keyword krlEnum individual_mames supply_voltage kinclass main_axis wrist_axis sw_onoff | |
196 " | |
197 " Predefined structures and enums found in /r1/mada/$robcor.dat | |
198 " syn keyword krlStructure | |
199 syn keyword krlEnum adap_acc model_type control_parameter eko_mode | |
200 " | |
201 " Predefined structures and enums found in /steu/mada/$custom.dat | |
202 syn keyword krlStructure pro_io_t ser ext_mod_t coop_krc ws_config bin_type coop_update_t ldc_reaction | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
203 syn keyword krlEnum axis_of_coordinates motion_mode spline_para_variant spreadstartpolicy target_status cp_vel_type cp_statmon |
28517 | 204 " |
205 " Predefined structures and enums found in /steu/mada/$machine.dat | |
206 syn keyword krlStructure emstop_path boxstatesafein boxstatesafeout | |
207 syn keyword krlEnum digincode | |
208 " | |
209 " Predefined structures and enums found in /steu/mada/$option.dat | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
210 syn keyword krlStructure installed_motion_modes msg_t |
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
211 syn keyword krlEnum step_enum |
28517 | 212 " syn keyword krlEnum |
213 " | |
214 " Predefined structures and enums found in /r1/system/$config.dat | |
215 " BasisTech | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
216 syn keyword krlStructure dig_out_type ctrl_in_t ctrl_out_t fct_out_t fct_in_t odat hdat basis_sugg_t out_sugg_t md_state machine_def_t machine_tool_t machine_frame_t trigger_para constvel_para condstop_para adat tm_sugg_t tqm_tqdat_t sps_prog_type |
28517 | 217 syn keyword krlEnum bas_command out_modetype ipo_m_t apo_mode_t funct_type p00_command timer_actiontype |
218 " | |
219 " GripperTech | |
220 syn keyword krlStructure grp_typ grp_types grp_sugg_t | |
221 syn keyword krlEnum on_off_typ apo_typ | |
222 " | |
223 " SpotTech | |
224 syn keyword krlStructure spot_type spot_sugg_t | |
225 syn keyword krlEnum s_command s_pair_slct command_retr | |
226 " | |
227 " VW | |
228 syn keyword krlStructure vw_mpara_typ zangentyp zangenbedingung ibszangentyp last_ibs_typ verr_typ verrcheck_t t_fb_state kollisionsdaten state_t modus_t | |
229 syn keyword krlEnum synctype dir_typ subtype ari_typ bool_typ vw_command ibgn_command vw_user_cmd move_types adv_t_type bas_type ibs_mode_typ vw_user_cmd pro_mode mode_op | |
230 " | |
231 " ProgCoop | |
232 syn keyword krlStructure ydat | |
233 " syn keyword krlEnum | |
234 " | |
235 " bas.src | |
236 syn keyword krlStructure cont | |
237 syn keyword krlEnum esys ipo_mode circ_mode circ_type ori_type var_state | |
238 " | |
239 " MsgLib.src | |
240 syn keyword krlStructure KrlMsg_T KrlMsgParType_T KrlMsgPar_T KrlMsgOpt_T KrlMsgDlgSK_T | |
241 syn keyword krlEnum EKrlMsgType | |
242 " | |
243 highlight default link krlStructure Structure | |
244 highlight default link krlEnum Structure | |
245 " }}} Predefined Structure and Enum | |
246 | |
247 " System variable {{{ | |
248 syn match krlSysvars /\<\$\a[a-zA-Z0-9_.]*/ | |
249 if g:krlGroupName | |
250 highlight default link krlSysvars Sysvars | |
251 else | |
252 " default color for Sysvars | |
253 endif | |
254 " }}} System variable | |
255 | |
256 " Statements, keywords et al {{{ | |
257 " continue | |
258 syn keyword krlContinue continue | |
259 if g:krlGroupName | |
260 highlight default link krlContinue Continue | |
261 else | |
262 highlight default link krlContinue Statement | |
263 endif | |
264 " interrupt | |
265 syn match krlStatement /\v\c%(<global>\s+)?<INTERRUPT>%(\s+<decl>)?/ contains=krlStorageClass | |
266 " keywords | |
267 syn keyword krlStatement wait on off enable disable stop trigger with when distance onstart delay do prio import is minimum maximum confirm on_error_proceed | |
268 syn match krlStatement /\v\c%(<wait\s+)@7<=<sec>/ | |
269 syn match krlStatement /\v\c%(<when\s+)@7<=<path>/ | |
270 highlight default link krlStatement Statement | |
271 " Conditional | |
272 syn keyword krlConditional if then else endif switch case default endswitch skip endskip | |
273 highlight default link krlConditional Conditional | |
274 " Repeat | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
275 syn keyword krlRepeat for to endfor while endwhile repeat until loop endloop exit |
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
276 " STEP is used as variable in VKRC, this pattern should match STEP -, 5(constant number) or VAR |
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
277 syn match krlRepeat /\v\cstep\s+%(-|\w)/me=e-1 |
28517 | 278 highlight default link krlRepeat Repeat |
279 " Label | |
280 syn keyword krlLabel goto | |
281 syn match krlLabel /^\s*\w\+:\ze\s*\%(;.*\)\?$/ | |
282 highlight default link krlLabel Label | |
283 " Keyword | |
284 syn keyword krlKeyword anin anout digin | |
285 highlight default link krlKeyword Keyword | |
286 " Exception | |
287 syn keyword krlException return resume halt | |
288 highlight default link krlException Exception | |
289 " }}} Statements, keywords et al | |
290 | |
291 " special keywords for movement commands {{{ | |
292 syn keyword krlMovement PTP PTP_REL LIN LIN_REL CIRC CIRC_REL SPL SPL_REL SPTP SPTP_REL SLIN SLIN_REL SCIRC SCIRC_REL | |
293 syn keyword krlMovement ASYPTP ASYCONT ASYSTOP ASYCANCEL MOVE_EMI | |
294 syn match krlMovement /\v\c^\s*<BRAKE(\s+F)?>/ | |
295 if g:krlGroupName | |
296 highlight default link krlMovement Movement | |
297 else | |
298 highlight default link krlMovement Special | |
299 endif | |
300 " movement modifiers | |
301 syn match krlMoveBlockInst /\c\v^\s*TIME_BLOCK\s+(START|PART|END)/ | |
302 syn match krlMoveBlockInst /\c\v^\s*CONST_VEL\s+(START|END)/ | |
303 syn keyword krlMoveBlockInst ptp_spline spline endspline | |
304 highlight default link krlMoveBlockInst Statement | |
305 syn keyword krlMoveMod ca c_ptp c_dis c_vel c_ori c_spl | |
306 if g:krlGroupName | |
307 highlight default link krlMoveMod Movement | |
308 else | |
309 highlight default link krlMoveMod Special | |
310 endif | |
311 " }}} special keywords for movement commands | |
312 | |
313 " Structure value {{{ | |
314 " avoid coloring structure component names | |
315 syn match krlNames /\.[a-zA-Z_][.a-zA-Z0-9_$]*/ | |
316 syn match krlNames contained /[a-zA-Z_][.a-zA-Z0-9_$]*/ | |
317 " highlight default link krlNames None | |
318 " Structure value | |
319 syn region krlStructVal start=/{/ end=/}/ oneline containedin=krlStructVal contains=krlNames | |
320 highlight default link krlStructVal Delimiter | |
321 " }}} Structure value | |
322 | |
323 " BuildInFunction {{{ | |
324 syn keyword krlBuildInFunction contained Pulse | |
325 syn keyword krlBuildInFunction contained m_comment | |
326 syn keyword krlBuildInFunction contained is_key_pressed | |
327 syn keyword krlBuildInFunction contained set_opt_filter | |
328 syn keyword krlBuildInFunction contained timer_limit | |
329 syn keyword krlBuildInFunction contained tool_adj | |
330 syn keyword krlBuildInFunction contained FRand | |
331 syn keyword krlBuildInFunction contained ExecFunc eb_test EB EK EO LK mbx_rec | |
332 " safe robot | |
333 syn keyword krlbuildinfunction contained get_AxesMask get_BrakeTest_Time | |
334 " math | |
335 syn keyword krlBuildInFunction contained Abs Sin Cos Acos Tan Atan Atan2 Sqrt | |
336 syn keyword krlBuildInFunction contained Forward Inverse inv_pos | |
337 " cFoo sFoo | |
338 syn keyword krlBuildInFunction contained cClose cOpen cRead cWrite sRead sWrite | |
339 " string | |
340 syn keyword krlBuildInFunction contained StrToBool StrToInt StrToReal StrToString StrToFrame StrToPos StrToE3Pos StrToE6Pos StrToAxis StrToE3Axis StrToE6Axis | |
341 syn keyword krlBuildInFunction contained StrAdd StrClear StrCopy StrComp StrFind StrLen StrDeclLen StrToBool StrToInt StrToReal StrToString | |
342 " diag | |
343 syn keyword krlBuildInFunction contained diag_start diag_stop get_DiagState | |
344 " rdc mam pid | |
345 syn keyword krlBuildInFunction contained CheckPidOnRdc check_mam_on_rdc get_rdc_fs_state | |
346 syn keyword krlBuildInFunction contained set_mam_on_hd copy_mam_hd_to_rdc copy_mam_rdc_to_hd | |
347 syn keyword krlBuildInFunction contained PidToHd PidToRdc | |
348 syn keyword krlBuildInFunction contained cal_to_rdc rdc_file_to_hd | |
349 syn keyword krlBuildInFunction contained delete_pid_on_rdc delete_rdc_content | |
350 syn keyword krlBuildInFunction contained create_rdc_archive restore_rdc_archive | |
351 " ioctl | |
352 syn keyword krlBuildInFunction contained IOCtl cIOCtl | |
353 syn keyword krlBuildInFunction contained WSpaceGive WSpaceTake | |
354 " sync | |
355 syn keyword krlBuildInFunction contained Sync SyncCmd CancelProgSync | |
356 " remote | |
357 syn keyword krlBuildInFunction contained RemoteCmd RemoteRead | |
358 " msg/dlg | |
359 syn keyword krlBuildInFunction contained IsMessageSet clear_KrlMsg get_MsgBuffer exists_KrlDlg exists_KrlMsg set_KrlDlg set_KrlDlgAnswer set_KrlMsg | |
360 " robvers | |
361 syn keyword krlBuildInFunction contained maximize_UsedxRobvers set_UsedxRobvers | |
362 " md_foo | |
363 syn keyword krlBuildInFunction contained md_Cmd md_GetState md_SetState md_Asgn | |
364 " emi | |
365 syn keyword krlBuildInFunction contained emi_ActPos emi_EndPos emi_StartPos emi_RecState emi_RecName | |
366 " var | |
367 syn keyword krlBuildInFunction contained cast_from cast_to | |
368 syn keyword krlBuildInFunction contained GetVarsize GetCycDef get_sig_inf get_decl_place VarType VarState | |
369 " sys | |
370 syn keyword krlBuildInFunction contained GetSysState get_system_data set_system_data set_system_data_delayed | |
371 " err | |
372 syn keyword krlBuildInFunction contained err_clear err_raise | |
373 " motion | |
374 syn keyword krlBuildInFunction contained delete_backward_buffer rob_stop rob_stop_release set_brake_delay suppress_repositioning VectorMoveOn VectorMoveOff | |
375 " torque | |
376 syn keyword krlBuildInFunction contained set_torque_limits reset_torque_limits | |
377 " krc1 | |
378 syn keyword krlBuildInFunction contained cLcopy cCurpos cNew cClear cRelease cKey | |
379 if g:krlGroupName | |
380 highlight default link krlBuildInFunction BuildInFunction | |
381 else | |
382 highlight default link krlBuildInFunction Function | |
383 endif | |
384 " }}} BuildInFunction | |
385 | |
386 " Function {{{ | |
387 syn match krlFunction /[a-zA-Z_]\w* *(/me=e-1 contains=krlBuildInFunction | |
388 highlight default link krlFunction Function | |
389 " }}} Function | |
390 | |
391 " Error {{{ | |
392 if get(g:, 'krlShowError', 1) | |
393 " some more or less common typos | |
394 " | |
395 " vars or funcs >24 chars are not possible in krl. a234567890123456789012345 | |
32718
3dd63e73de28
Update krl and add rapid syntax files (#12750)
Christian Brabandt <cb@256bit.org>
parents:
28517
diff
changeset
|
396 syn match krlError0 /\w\{25,}/ containedin=krlFunction,krlNames,krlLabel,krlEnumVal,krlSysvars |
28517 | 397 " |
398 " should be interrupt (on|off) \w+ | |
399 syn match krlError1 /\vinterrupt[ \t(]+[_$a-zA-Z0-9]+[_$a-zA-Z0-9.\[\]()+\-*/]*[ \t)]+o%(n|ff)>/ | |
400 " | |
401 " for bla==5 to 7... | |
402 " || | |
403 syn match krlError3 /\v%(^\s*for%(\(|\s)+[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/ ]*\s*)@<=[:=]\=/ | |
404 " | |
405 " TODO optimize performance | |
406 " wait for a=b | |
407 " | | |
408 syn match krlError4 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;<>=])@<=\=[^=]/ | |
409 " | |
410 " wait for a><b | |
411 " || | |
412 syn match krlError5 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+)@<=\>\s*\</ | |
413 " | |
414 " if (a==5) (b==6) ... | |
415 " ||| | |
416 syn match krlError6 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@<=\)\s*\(/ | |
417 " | |
418 " TODO optimize performance | |
419 " a == b + 1 | |
420 " a := b + 1 | |
421 " || | |
422 syn match krlError7 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@1<!%(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\],+\-*/]*\s*)@<=[:=]\=/ | |
423 syn match krlError7 /\v\c%(^\s*%(decl\s+)%(global\s+)?%(const\s+)?\w+\s+\w+\s*)@<=[:=]\=/ | |
424 syn match krlError7 /\v\c%(^\s*%(decl\s+)?%(global\s+)?%(const\s+)?%(bool\s+|int\s+|real\s+|char\s+)\w+\s*)@<=[:=]\=/ | |
425 " | |
426 " this one is tricky. Make sure this does not match trigger instructions; OK, next try, now search for false positives | |
427 " TODO optimize performance | |
428 " a = b and c or (int1=int2) | |
429 " | | |
430 syn match krlError8 /\v(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/]*\s*\=[^;]*[^;<>=])@<=\=\ze[^=]/ | |
431 " | |
432 " <(distance|delay|prio)> := | |
433 " <(distance|delay|prio)> == | |
434 " || | |
435 syn match krlError9 /\v(^[^;]*<(distance|delay|prio|minimum|maximum)\s*)@<=[:=]\=/ | |
436 " | |
437 " 'for', 'while' or 'repeat' followed by 'do' | |
438 syn match krlError10 /\c\v^\s*(until|while|for)>[^;]*<do>/ | |
439 " | |
440 highlight default link krlError0 Error | |
441 highlight default link krlError1 Error | |
442 highlight default link krlError2 Error | |
443 highlight default link krlError3 Error | |
444 highlight default link krlError4 Error | |
445 highlight default link krlError5 Error | |
446 highlight default link krlError6 Error | |
447 highlight default link krlError7 Error | |
448 highlight default link krlError8 Error | |
449 highlight default link krlError9 Error | |
450 highlight default link krlError10 Error | |
451 endif | |
452 " }}} Error | |
453 | |
454 " Finish {{{ | |
455 let &cpo = s:keepcpo | |
456 unlet s:keepcpo | |
457 | |
458 let b:current_syntax = "krl" | |
459 " }}} Finish | |
460 | |
461 " vim:sw=2 sts=2 et fdm=marker |