annotate runtime/syntax/cupl.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 11b656e74444
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: CUPL
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
3 " Maintainer: John Cook <johncook3@gmail.com>
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
4 " Last Change: 2011 Dec 27
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3237
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: 3237
diff changeset
7 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
11 let s:cpo_save = &cpo
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
12 set cpo&vim
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
13
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " this language is oblivious to case.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " A bunch of keywords
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 syn keyword cuplHeader name partno date revision rev designer company nextgroup=cuplHeaderContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 syn keyword cuplHeader assembly assy location device nextgroup=cuplHeaderContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 syn keyword cuplTodo contained TODO XXX FIXME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " cuplHeaderContents uses default highlighting except for numbers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 syn match cuplHeaderContents ".\+;"me=e-1 contains=cuplNumber contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
25773
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
26 " String constants
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn region cuplString start=+'+ end=+'+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn region cuplString start=+"+ end=+"+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 syn keyword cuplStatement append condition
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn keyword cuplStatement default else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 syn keyword cuplStatement field fld format function fuse
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn keyword cuplStatement group if jump loc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 syn keyword cuplStatement macro min node out
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syn keyword cuplStatement pin pinnode present table
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn keyword cuplStatement sequence sequenced sequencejk sequencers sequencet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn keyword cuplFunction log2 log8 log16 log
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " Valid integer number formats (decimal, binary, octal, hex)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn match cuplNumber "\<[-+]\=[0-9]\+\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn match cuplNumber "'d'[0-9]\+\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn match cuplNumber "'b'[01x]\+\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syn match cuplNumber "'o'[0-7x]\+\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn match cuplNumber "'h'[0-9a-fx]\+\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 " operators
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match cuplLogicalOperator "[!#&$]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match cuplArithmeticOperator "[-+*/%]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 syn match cuplArithmeticOperator "\*\*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 syn match cuplAssignmentOperator ":\=="
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 syn match cuplEqualityOperator ":"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn match cuplTruthTableOperator "=>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 " Signal extensions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 syn match cuplExtension "\.[as][pr]\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 syn match cuplExtension "\.oe\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 syn match cuplExtension "\.oemux\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 syn match cuplExtension "\.[dlsrjk]\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 syn match cuplExtension "\.ck\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 syn match cuplExtension "\.dq\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 syn match cuplExtension "\.ckmux\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 syn match cuplExtension "\.tec\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn match cuplExtension "\.cnt\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn match cuplRangeOperator "\.\." contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " match ranges like memadr:[0000..1FFF]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " and highlight both the numbers and the .. operator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn match cuplNumberRange "\<\x\+\.\.\x\+\>" contains=cuplRangeOperator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 " match vectors of type [name3..0] (decimal numbers only)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " but assign them no special highlighting except for the .. operator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 syn match cuplBitVector "\<\a\+\d\+\.\.\d\+\>" contains=cuplRangeOperator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " other special characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 syn match cuplSpecialChar "[\[\](){},;]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " directives
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " (define these after cuplOperator so $xxx overrides $)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn match cuplDirective "\$msg"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 syn match cuplDirective "\$macro"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 syn match cuplDirective "\$mend"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 syn match cuplDirective "\$repeat"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 syn match cuplDirective "\$repend"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 syn match cuplDirective "\$define"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 syn match cuplDirective "\$include"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 " multi-line comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn region cuplComment start=+/\*+ end=+\*/+ contains=cuplNumber,cuplTodo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 syn sync minlines=1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3237
diff changeset
95 " Only when an item doesn't have highlighting yet
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3237
diff changeset
97 " The default highlighting.
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
98 hi def link cuplHeader cuplStatement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
99 hi def link cuplLogicalOperator cuplOperator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
100 hi def link cuplRangeOperator cuplOperator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
101 hi def link cuplArithmeticOperator cuplOperator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
102 hi def link cuplAssignmentOperator cuplOperator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
103 hi def link cuplEqualityOperator cuplOperator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
104 hi def link cuplTruthTableOperator cuplOperator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
105 hi def link cuplOperator cuplStatement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
106 hi def link cuplFunction cuplStatement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
107 hi def link cuplStatement Statement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
108 hi def link cuplNumberRange cuplNumber
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
109 hi def link cuplNumber cuplString
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
110 hi def link cuplString String
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
111 hi def link cuplComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
112 hi def link cuplExtension cuplSpecial
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
113 hi def link cuplSpecialChar cuplSpecial
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
114 hi def link cuplSpecial Special
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
115 hi def link cuplDirective PreProc
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
116 hi def link cuplTodo Todo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 let b:current_syntax = "cupl"
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
120
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
121 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
122 unlet s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
123
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 " vim:ts=8