Mercurial > vim
annotate runtime/syntax/hex.vim @ 31184:6b218e595d9f v9.0.0926
patch 9.0.0926: Coverity warns for not using return value of dict_add()
Commit: https://github.com/vim/vim/commit/bc222152d8dea252aa5f1fa24b5536ed269feb92
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 23 11:34:01 2022 +0000
patch 9.0.0926: Coverity warns for not using return value of dict_add()
Problem: Coverity warns for not using return value of dict_add().
Solution: When dict_add() fails then don't call hash_remove().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 23 Nov 2022 12:45:04 +0100 |
parents | 46763b01cd9a |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
6697 | 2 " Language: Intel HEX |
3 " Maintainer: Markus Heidelberg <markus.heidelberg@web.de> | |
4 " Previous version: Sams Ricahrd <sams@ping.at> | |
5 " Last Change: 2015 Feb 24 | |
6 | |
7 " Each record (line) is built as follows: | |
8 " | |
9 " field digits states | |
10 " | |
11 " +----------+ | |
12 " | start | 1 (':') hexRecStart | |
13 " +----------+ | |
14 " | count | 2 hexDataByteCount | |
15 " +----------+ | |
16 " | address | 4 hexNoAddress, hexDataAddress, (hexAddressFieldUnknown) | |
17 " +----------+ | |
18 " | type | 2 hexRecType, (hexRecTypeUnknown) | |
19 " +----------+ | |
20 " | data | 0..510 hexDataOdd, hexDataEven, hexExtendedAddress, hexStartAddress, (hexDataFieldUnknown, hexDataUnexpected) | |
21 " +----------+ | |
22 " | checksum | 2 hexChecksum | |
23 " +----------+ | |
24 " | |
25 " States in parentheses in the upper format description indicate that they | |
26 " should not appear in a valid file. | |
7 | 27 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
28 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
29 if exists("b:current_syntax") |
7 | 30 finish |
31 endif | |
32 | |
6697 | 33 syn match hexRecStart "^:" |
34 | |
35 syn match hexDataByteCount "^:[0-9a-fA-F]\{2}" contains=hexRecStart nextgroup=hexAddress | |
7 | 36 |
6697 | 37 syn match hexAddress "[0-9a-fA-F]\{4}" transparent contained nextgroup=hexRecTypeUnknown,hexRecType |
38 " The address field groups include the record type field in the last 2 | |
39 " characters, the proper match for highlighting follows below. | |
40 syn match hexAddressFieldUnknown "^:[0-9a-fA-F]\{8}" contains=hexDataByteCount nextgroup=hexDataFieldUnknown,hexChecksum | |
41 syn match hexDataAddress "^:[0-9a-fA-F]\{6}00" contains=hexDataByteCount nextgroup=hexDataOdd,hexChecksum | |
42 syn match hexNoAddress "^:[0-9a-fA-F]\{6}01" contains=hexDataByteCount nextgroup=hexDataUnexpected,hexChecksum | |
43 syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[24]" contains=hexDataByteCount nextgroup=hexExtendedAddress | |
44 syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[35]" contains=hexDataByteCount nextgroup=hexStartAddress | |
45 | |
46 syn match hexRecTypeUnknown "[0-9a-fA-F]\{2}" contained | |
47 syn match hexRecType "0[0-5]" contained | |
7 | 48 |
6697 | 49 syn match hexDataFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=hexDataFieldUnknown,hexChecksum |
50 " alternating highlight per byte for easier reading | |
51 syn match hexDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=hexDataEven,hexChecksum | |
52 syn match hexDataEven "[0-9a-fA-F]\{2}" contained nextgroup=hexDataOdd,hexChecksum | |
53 " data bytes which should not exist | |
54 syn match hexDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=hexDataUnexpected,hexChecksum | |
55 " Data digit pair regex usage also results in only highlighting the checksum | |
56 " if the number of data characters is even. | |
7 | 57 |
6697 | 58 " special data fields |
59 syn match hexExtendedAddress "[0-9a-fA-F]\{4}" contained nextgroup=hexDataUnexpected,hexChecksum | |
60 syn match hexStartAddress "[0-9a-fA-F]\{8}" contained nextgroup=hexDataUnexpected,hexChecksum | |
61 | |
62 syn match hexChecksum "[0-9a-fA-F]\{2}$" contained | |
63 | |
64 " Folding Data Records below an Extended Segment/Linear Address Record | |
65 syn region hexExtAdrBlock start="^:[0-9a-fA-F]\{7}[24]" skip="^:[0-9a-fA-F]\{7}0" end="^:"me=s-1 fold transparent | |
7 | 66 |
67 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
68 " Only when an item doesn't have highlighting yet |
7 | 69 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
70 " The default methods for highlighting. Can be overridden later |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
71 hi def link hexRecStart hexRecType |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
72 hi def link hexDataByteCount Constant |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
73 hi def hexAddressFieldUnknown term=italic cterm=italic gui=italic |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
74 hi def link hexDataAddress Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
75 hi def link hexNoAddress DiffAdd |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
76 hi def link hexRecTypeUnknown hexRecType |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
77 hi def link hexRecType WarningMsg |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
78 hi def hexDataFieldUnknown term=italic cterm=italic gui=italic |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
79 hi def hexDataOdd term=bold cterm=bold gui=bold |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6697
diff
changeset
|
80 hi def hexDataEven term=NONE cterm=NONE gui=NONE |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
81 hi def link hexDataUnexpected Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
82 hi def link hexExtendedAddress hexDataAddress |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
83 hi def link hexStartAddress hexDataAddress |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
84 hi def link hexChecksum DiffChange |
7 | 85 |
86 | |
87 let b:current_syntax = "hex" | |
88 | |
89 " vim: ts=8 |