Mercurial > vim
annotate runtime/syntax/lss.vim @ 34074:1629cc65d78d v9.1.0006
patch 9.1.0006: is*() and to*() function may be unsafe
Commit: https://github.com/vim/vim/commit/184f71cc6868a240dc872ed2852542bbc1d43e28
Author: Keith Thompson <Keith.S.Thompson@gmail.com>
Date: Thu Jan 4 21:19:04 2024 +0100
patch 9.1.0006: is*() and to*() function may be unsafe
Problem: is*() and to*() function may be unsafe
Solution: Add SAFE_* macros and start using those instead
(Keith Thompson)
Use SAFE_() macros for is*() and to*() functions
The standard is*() and to*() functions declared in <ctype.h> have
undefined behavior for negative arguments other than EOF. If plain char
is signed, passing an unchecked value from argv for from user input
to one of these functions has undefined behavior.
Solution: Add SAFE_*() macros that cast the argument to unsigned char.
Most implementations behave sanely for negative arguments, and most
character values in practice are non-negative, but it's still best
to avoid undefined behavior.
The change from #13347 has been omitted, as this has already been
separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a
(v9.0.2054)
fixes: #13332
closes: #13347
Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 04 Jan 2024 21:30:04 +0100 |
parents | d46f974fd69e |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: Lynx 2.7.1 style file | |
26 | 3 " Maintainer: Scott Bigham <dsb@killerbunnies.org> |
4 " Last Change: 2004 Oct 06 | |
7 | 5 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
6 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
7 if exists("b:current_syntax") |
7 | 8 finish |
9 endif | |
10 | |
11 " This setup is probably atypical for a syntax highlighting file, because | |
32974
d46f974fd69e
runtime: Fix typos in various files
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
12 " most of it is not really intended to be overridable. Instead, the |
7 | 13 " highlighting is supposed to correspond to the highlighting specified by |
14 " the .lss file entries themselves; ie. the "bold" keyword should be bold, | |
15 " the "red" keyword should be red, and so forth. The exceptions to this | |
16 " are comments, of course, and the initial keyword identifying the affected | |
17 " element, which will inherit the usual Identifier highlighting. | |
18 | |
19 syn match lssElement "^[^:]\+" nextgroup=lssMono | |
20 | |
21 syn match lssMono ":[^:]\+" contained nextgroup=lssFgColor contains=lssReverse,lssUnderline,lssBold,lssStandout | |
22 | |
23 syn keyword lssBold bold contained | |
24 syn keyword lssReverse reverse contained | |
25 syn keyword lssUnderline underline contained | |
26 syn keyword lssStandout standout contained | |
27 | |
28 syn match lssFgColor ":[^:]\+" contained nextgroup=lssBgColor contains=lssRedFg,lssBlueFg,lssGreenFg,lssBrownFg,lssMagentaFg,lssCyanFg,lssLightgrayFg,lssGrayFg,lssBrightredFg,lssBrightgreenFg,lssYellowFg,lssBrightblueFg,lssBrightmagentaFg,lssBrightcyanFg | |
29 | |
30 syn case ignore | |
31 syn keyword lssRedFg red contained | |
32 syn keyword lssBlueFg blue contained | |
33 syn keyword lssGreenFg green contained | |
34 syn keyword lssBrownFg brown contained | |
35 syn keyword lssMagentaFg magenta contained | |
36 syn keyword lssCyanFg cyan contained | |
37 syn keyword lssLightgrayFg lightgray contained | |
38 syn keyword lssGrayFg gray contained | |
39 syn keyword lssBrightredFg brightred contained | |
40 syn keyword lssBrightgreenFg brightgreen contained | |
41 syn keyword lssYellowFg yellow contained | |
42 syn keyword lssBrightblueFg brightblue contained | |
43 syn keyword lssBrightmagentaFg brightmagenta contained | |
44 syn keyword lssBrightcyanFg brightcyan contained | |
45 syn case match | |
46 | |
47 syn match lssBgColor ":[^:]\+" contained contains=lssRedBg,lssBlueBg,lssGreenBg,lssBrownBg,lssMagentaBg,lssCyanBg,lssLightgrayBg,lssGrayBg,lssBrightredBg,lssBrightgreenBg,lssYellowBg,lssBrightblueBg,lssBrightmagentaBg,lssBrightcyanBg,lssWhiteBg | |
48 | |
49 syn case ignore | |
50 syn keyword lssRedBg red contained | |
51 syn keyword lssBlueBg blue contained | |
52 syn keyword lssGreenBg green contained | |
53 syn keyword lssBrownBg brown contained | |
54 syn keyword lssMagentaBg magenta contained | |
55 syn keyword lssCyanBg cyan contained | |
56 syn keyword lssLightgrayBg lightgray contained | |
57 syn keyword lssGrayBg gray contained | |
58 syn keyword lssBrightredBg brightred contained | |
59 syn keyword lssBrightgreenBg brightgreen contained | |
60 syn keyword lssYellowBg yellow contained | |
61 syn keyword lssBrightblueBg brightblue contained | |
62 syn keyword lssBrightmagentaBg brightmagenta contained | |
63 syn keyword lssBrightcyanBg brightcyan contained | |
64 syn keyword lssWhiteBg white contained | |
65 syn case match | |
66 | |
67 syn match lssComment "#.*$" | |
68 | |
69 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
70 " Only when an item doesn't have highlighting yet |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
71 hi def link lssComment Comment |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
72 hi def link lssElement Identifier |
7 | 73 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
74 hi def lssBold term=bold cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
75 hi def lssReverse term=reverse cterm=reverse |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
76 hi def lssUnderline term=underline cterm=underline |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
77 hi def lssStandout term=standout cterm=standout |
7 | 78 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
79 hi def lssRedFg ctermfg=red |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
80 hi def lssBlueFg ctermfg=blue |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
81 hi def lssGreenFg ctermfg=green |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
82 hi def lssBrownFg ctermfg=brown |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
83 hi def lssMagentaFg ctermfg=magenta |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
84 hi def lssCyanFg ctermfg=cyan |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
85 hi def lssGrayFg ctermfg=gray |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
86 if $COLORTERM == "rxvt" |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
87 " On rxvt's, bright colors are activated by setting the bold attribute. |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
88 hi def lssLightgrayFg ctermfg=gray cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
89 hi def lssBrightredFg ctermfg=red cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
90 hi def lssBrightgreenFg ctermfg=green cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
91 hi def lssYellowFg ctermfg=yellow cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
92 hi def lssBrightblueFg ctermfg=blue cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
93 hi def lssBrightmagentaFg ctermfg=magenta cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
94 hi def lssBrightcyanFg ctermfg=cyan cterm=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
95 else |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
96 hi def lssLightgrayFg ctermfg=lightgray |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
97 hi def lssBrightredFg ctermfg=lightred |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
98 hi def lssBrightgreenFg ctermfg=lightgreen |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
99 hi def lssYellowFg ctermfg=yellow |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
100 hi def lssBrightblueFg ctermfg=lightblue |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
101 hi def lssBrightmagentaFg ctermfg=lightmagenta |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
102 hi def lssBrightcyanFg ctermfg=lightcyan |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
103 endif |
7 | 104 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
105 hi def lssRedBg ctermbg=red |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
106 hi def lssBlueBg ctermbg=blue |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
107 hi def lssGreenBg ctermbg=green |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
108 hi def lssBrownBg ctermbg=brown |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
109 hi def lssMagentaBg ctermbg=magenta |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
110 hi def lssCyanBg ctermbg=cyan |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
111 hi def lssLightgrayBg ctermbg=lightgray |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
112 hi def lssGrayBg ctermbg=gray |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
113 hi def lssBrightredBg ctermbg=lightred |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
114 hi def lssBrightgreenBg ctermbg=lightgreen |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
115 hi def lssYellowBg ctermbg=yellow |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
116 hi def lssBrightblueBg ctermbg=lightblue |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
117 hi def lssBrightmagentaBg ctermbg=lightmagenta |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
118 hi def lssBrightcyanBg ctermbg=lightcyan |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
26
diff
changeset
|
119 hi def lssWhiteBg ctermbg=white ctermfg=black |
7 | 120 |
121 let b:current_syntax = "lss" | |
122 | |
123 " vim: ts=8 |