annotate runtime/syntax/dictconf.vim @ 34684:faf891660963 v9.1.0223

patch 9.1.0223: code duplication in loop to add active text properties Commit: https://github.com/vim/vim/commit/1134fdd1b369119d0d6992e3120bb5f7c788b697 Author: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Date: Thu Mar 28 11:49:46 2024 +0100 patch 9.1.0223: code duplication in loop to add active text properties Problem: There are two dense conditions with duplication that needs to be kept in sync between the while loop break condition and the condition to skip certain text properties. Solution: Refactor the loop by moving while loop conditions into the body of the while loop so they can be shared with skip conditions. `break` and an `active` variable are used to handle the outcome of these merged conditions. (Dylan Thacker-Smith) closes: #14307 Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Mar 2024 12:00:05 +0100
parents 1218c5353e2b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
389
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
1 " Vim syntax file
11062
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
2 " Language: dict(1) configuration file
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
4 " Latest Revision: 2006-04-19
389
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
5
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
6 if exists("b:current_syntax")
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
7 finish
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
8 endif
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
9
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
10 let s:cpo_save = &cpo
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
11 set cpo&vim
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
12
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
13 syn keyword dictconfTodo contained TODO FIXME XXX NOTE
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
14
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
15 syn region dictconfComment display oneline start='#' end='$'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
16 \ contains=dictconfTodo,@Spell
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
17
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
18 syn match dictconfBegin display '^'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
19 \ nextgroup=dictconfKeyword,dictconfComment
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
20 \ skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
21
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
22 syn keyword dictconfKeyword contained server
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
23 \ nextgroup=dictconfServer skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
24
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
25 syn keyword dictconfKeyword contained pager
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
26 \ nextgroup=dictconfPager
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
27
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
28 syn match dictconfServer contained display
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
29 \ '[[:alnum:]_/.*-][[:alnum:]_/.*-]*'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
30 \ nextgroup=dictconfServerOptG skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
31
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
32 syn region dictconfServer contained display oneline
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
33 \ start=+"+ skip=+""+ end=+"+
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
34 \ nextgroup=dictconfServerOptG skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
35
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
36 syn region dictconfServerOptG contained transparent
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
37 \ matchgroup=dictconfServerOptsD start='{'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
38 \ matchgroup=dictconfServerOptsD end='}'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
39 \ contains=dictconfServerOpts,dictconfComment
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
40
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
41 syn keyword dictconfServerOpts contained port
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
42 \ nextgroup=dictconfNumber skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
43
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
44 syn keyword dictconfServerOpts contained user
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
45 \ nextgroup=dictconfUsername skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
46
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
47 syn match dictconfUsername contained display
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
48 \ '[[:alnum:]_/.*-][[:alnum:]_/.*-]*'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
49 \ nextgroup=dictconfSecret skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
50 syn region dictconfUsername contained display oneline
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
51 \ start=+"+ skip=+""+ end=+"+
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
52 \ nextgroup=dictconfSecret skipwhite
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
53
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
54 syn match dictconfSecret contained display
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
55 \ '[[:alnum:]_/.*-][[:alnum:]_/.*-]*'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
56 syn region dictconfSecret contained display oneline
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
57 \ start=+"+ skip=+""+ end=+"+
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
58
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
59 syn match dictconfNumber contained '\<\d\+\>'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
60
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
61 syn match dictconfPager contained display
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
62 \ '[[:alnum:]_/.*-][[:alnum:]_/.*-]*'
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
63 syn region dictconfPager contained display oneline
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
64 \ start=+"+ skip=+""+ end=+"+
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
65
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
66 hi def link dictconfTodo Todo
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
67 hi def link dictconfComment Comment
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
68 hi def link dictconfKeyword Keyword
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
69 hi def link dictconfServer String
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
70 hi def link dictconfServerOptsD Delimiter
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
71 hi def link dictconfServerOpts Identifier
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
72 hi def link dictconfUsername String
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
73 hi def link dictconfSecret Special
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
74 hi def link dictconfNumber Number
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
75 hi def link dictconfPager String
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
76
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
77 let b:current_syntax = "dictconf"
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
78
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
79 let &cpo = s:cpo_save
4fe8e1a7758e updated for version 7.0102
vimboss
parents:
diff changeset
80 unlet s:cpo_save