annotate runtime/syntax/srec.vim @ 8979:a1dac213df8b v7.4.1775

commit https://github.com/vim/vim/commit/763b684373bf5954445d8d8d99da1e39a4fc5105 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 22 12:24:52 2016 +0200 patch 7.4.1775 Problem: The rgb.txt file is not installed. Solution: Install the file. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Fri, 22 Apr 2016 12:30:06 +0200
parents 12155a47f6c2
children 43efa4f5a8ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6697
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: Motorola S-Record
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 " Maintainer: Markus Heidelberg <markus.heidelberg@web.de>
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 " Last Change: 2015 Feb 24
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Each record (line) is built as follows:
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 "
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 " field digits states
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 "
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 " | start | 1 ('S') srecRecStart
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 " | type | 1 srecRecType, (srecRecTypeUnknown)
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 " | count | 2 srecByteCount
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 " | address | 4/6/8 srecNoAddress, srecDataAddress, srecRecCount, srecStartAddress, (srecAddressFieldUnknown)
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 " | data | 0..504/502/500 srecDataOdd, srecDataEven, (srecDataUnexpected)
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 " | checksum | 2 srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 " +----------+
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 "
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 " States in parentheses in the upper format description indicate that they
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 " should not appear in a valid file.
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 " For version 5.x: Clear all syntax items
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 " For version 6.x: Quit when a syntax file was already loaded
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 if version < 600
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 syntax clear
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 elseif exists("b:current_syntax")
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 finish
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 endif
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 syn match srecRecStart "^S"
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 syn match srecRecTypeUnknown "^S." contains=srecRecStart
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 syn match srecRecType "^S[0-35-9]" contains=srecRecStart
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 syn match srecByteCount "^S.[0-9a-fA-F]\{2}" contains=srecRecTypeUnknown nextgroup=srecAddressFieldUnknown,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 syn match srecByteCount "^S[0-35-9][0-9a-fA-F]\{2}" contains=srecRecType
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 syn match srecAddressFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=srecAddressFieldUnknown,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 syn match srecNoAddress "^S0[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 syn match srecDataAddress "^S1[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 syn match srecDataAddress "^S2[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 syn match srecDataAddress "^S3[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 syn match srecRecCount "^S5[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 syn match srecRecCount "^S6[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 syn match srecStartAddress "^S7[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 syn match srecStartAddress "^S8[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 syn match srecStartAddress "^S9[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 " alternating highlight per byte for easier reading
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 syn match srecDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=srecDataEven,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 syn match srecDataEven "[0-9a-fA-F]\{2}" contained nextgroup=srecDataOdd,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 " data bytes which should not exist
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 syn match srecDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=srecDataUnexpected,srecChecksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 " Data digit pair regex usage also results in only highlighting the checksum
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 " if the number of data characters is even.
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 syn match srecChecksum "[0-9a-fA-F]\{2}$" contained
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 " Define the default highlighting.
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 " For version 5.7 and earlier: only when not done already
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 " For version 5.8 and later: only when an item doesn't have highlighting yet
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 if version >= 508 || !exists("did_srec_syntax_inits")
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 if version < 508
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 let did_srec_syntax_inits = 1
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 command -nargs=+ HiLink hi link <args>
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 else
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 command -nargs=+ HiLink hi def link <args>
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 endif
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 " The default methods for highlighting. Can be overridden later
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 HiLink srecRecStart srecRecType
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 HiLink srecRecTypeUnknown srecRecType
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 HiLink srecRecType WarningMsg
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 HiLink srecByteCount Constant
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 hi def srecAddressFieldUnknown term=italic cterm=italic gui=italic
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 HiLink srecNoAddress DiffAdd
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 HiLink srecDataAddress Comment
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 HiLink srecRecCount srecNoAddress
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 HiLink srecStartAddress srecDataAddress
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 hi def srecDataOdd term=bold cterm=bold gui=bold
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 hi def srecDataEven term=NONE cterm=NONE gui=NONE
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 HiLink srecDataUnexpected Error
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 HiLink srecChecksum DiffChange
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 delcommand HiLink
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 endif
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 let b:current_syntax = "srec"
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95
12155a47f6c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 " vim: ts=8