comparison runtime/syntax/hex.vim @ 6697:12155a47f6c2

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Sat, 21 Mar 2015 18:06:14 +0100
parents 3fc0f57ecb91
children 43efa4f5a8ea
comparison
equal deleted inserted replaced
6696:949ab7b65ad5 6697:12155a47f6c2
1 " Vim syntax file 1 " Vim syntax file
2 " Language: Intel hex MCS51 2 " Language: Intel HEX
3 " Maintainer: Sams Ricahrd <sams@ping.at> 3 " Maintainer: Markus Heidelberg <markus.heidelberg@web.de>
4 " Last Change: 2003 Apr 25 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.
5 27
6 " For version 5.x: Clear all syntax items 28 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded 29 " For version 6.x: Quit when a syntax file was already loaded
8 if version < 600 30 if version < 600
9 syntax clear 31 syntax clear
10 elseif exists("b:current_syntax") 32 elseif exists("b:current_syntax")
11 finish 33 finish
12 endif 34 endif
13 35
14 syn case ignore 36 syn match hexRecStart "^:"
15 37
16 " storage types 38 syn match hexDataByteCount "^:[0-9a-fA-F]\{2}" contains=hexRecStart nextgroup=hexAddress
17 39
18 syn match hexChecksum "[0-9a-fA-F]\{2}$" 40 syn match hexAddress "[0-9a-fA-F]\{4}" transparent contained nextgroup=hexRecTypeUnknown,hexRecType
19 syn match hexAdress "^:[0-9a-fA-F]\{6}" contains=hexDataByteCount 41 " The address field groups include the record type field in the last 2
20 syn match hexRecType "^:[0-9a-fA-F]\{8}" contains=hexAdress 42 " characters, the proper match for highlighting follows below.
21 syn match hexDataByteCount contained "^:[0-9a-fA-F]\{2}" contains=hexStart 43 syn match hexAddressFieldUnknown "^:[0-9a-fA-F]\{8}" contains=hexDataByteCount nextgroup=hexDataFieldUnknown,hexChecksum
22 syn match hexStart contained "^:" 44 syn match hexDataAddress "^:[0-9a-fA-F]\{6}00" contains=hexDataByteCount nextgroup=hexDataOdd,hexChecksum
23 syn match hexExtAdrRec "^:02000002[0-9a-fA-F]\{4}" contains=hexSpecRec 45 syn match hexNoAddress "^:[0-9a-fA-F]\{6}01" contains=hexDataByteCount nextgroup=hexDataUnexpected,hexChecksum
24 syn match hexExtLinAdrRec "^:02000004[0-9a-fA-F]\{4}" contains=hexSpecRec 46 syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[24]" contains=hexDataByteCount nextgroup=hexExtendedAddress
25 syn match hexSpecRec contained "^:0[02]00000[124]" contains=hexStart 47 syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[35]" contains=hexDataByteCount nextgroup=hexStartAddress
26 syn match hexEOF "^:00000001" contains=hexStart
27 48
28 syn case match 49 syn match hexRecTypeUnknown "[0-9a-fA-F]\{2}" contained
50 syn match hexRecType "0[0-5]" contained
51
52 syn match hexDataFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=hexDataFieldUnknown,hexChecksum
53 " alternating highlight per byte for easier reading
54 syn match hexDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=hexDataEven,hexChecksum
55 syn match hexDataEven "[0-9a-fA-F]\{2}" contained nextgroup=hexDataOdd,hexChecksum
56 " data bytes which should not exist
57 syn match hexDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=hexDataUnexpected,hexChecksum
58 " Data digit pair regex usage also results in only highlighting the checksum
59 " if the number of data characters is even.
60
61 " special data fields
62 syn match hexExtendedAddress "[0-9a-fA-F]\{4}" contained nextgroup=hexDataUnexpected,hexChecksum
63 syn match hexStartAddress "[0-9a-fA-F]\{8}" contained nextgroup=hexDataUnexpected,hexChecksum
64
65 syn match hexChecksum "[0-9a-fA-F]\{2}$" contained
66
67 " Folding Data Records below an Extended Segment/Linear Address Record
68 syn region hexExtAdrBlock start="^:[0-9a-fA-F]\{7}[24]" skip="^:[0-9a-fA-F]\{7}0" end="^:"me=s-1 fold transparent
29 69
30 " Define the default highlighting. 70 " Define the default highlighting.
31 " For version 5.7 and earlier: only when not done already 71 " For version 5.7 and earlier: only when not done already
32 " For version 5.8 and later: only when an item doesn't have highlighting yet 72 " For version 5.8 and later: only when an item doesn't have highlighting yet
33 if version >= 508 || !exists("did_hex_syntax_inits") 73 if version >= 508 || !exists("did_hex_syntax_inits")
36 command -nargs=+ HiLink hi link <args> 76 command -nargs=+ HiLink hi link <args>
37 else 77 else
38 command -nargs=+ HiLink hi def link <args> 78 command -nargs=+ HiLink hi def link <args>
39 endif 79 endif
40 80
41 " The default methods for highlighting. Can be overridden later 81 " The default methods for highlighting. Can be overridden later
42 HiLink hexStart SpecialKey 82 HiLink hexRecStart hexRecType
43 HiLink hexDataByteCount Constant 83 HiLink hexDataByteCount Constant
44 HiLink hexAdress Comment 84 hi def hexAddressFieldUnknown term=italic cterm=italic gui=italic
45 HiLink hexRecType WarningMsg 85 HiLink hexDataAddress Comment
46 HiLink hexChecksum Search 86 HiLink hexNoAddress DiffAdd
47 HiLink hexExtAdrRec hexAdress 87 HiLink hexRecTypeUnknown hexRecType
48 HiLink hexEOF hexSpecRec 88 HiLink hexRecType WarningMsg
49 HiLink hexExtLinAdrRec hexAdress 89 hi def hexDataFieldUnknown term=italic cterm=italic gui=italic
50 HiLink hexSpecRec DiffAdd 90 hi def hexDataOdd term=bold cterm=bold gui=bold
91 hi def hexDataEven term=NONE cterm=NONE gui=NONE
92 HiLink hexDataUnexpected Error
93 HiLink hexExtendedAddress hexDataAddress
94 HiLink hexStartAddress hexDataAddress
95 HiLink hexChecksum DiffChange
51 96
52 delcommand HiLink 97 delcommand HiLink
53 endif 98 endif
54 99
55 let b:current_syntax = "hex" 100 let b:current_syntax = "hex"