neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

srec.vim (3815B)


      1 " Vim syntax file
      2 " Language:	Motorola S-Record
      3 " Maintainer:	Markus Heidelberg <markus.heidelberg@web.de>
      4 " Last Change:	2015 Feb 24
      5 
      6 " Each record (line) is built as follows:
      7 "
      8 "    field       digits          states
      9 "
     10 "  +----------+
     11 "  | start    |  1 ('S')         srecRecStart
     12 "  +----------+
     13 "  | type     |  1               srecRecType, (srecRecTypeUnknown)
     14 "  +----------+
     15 "  | count    |  2               srecByteCount
     16 "  +----------+
     17 "  | address  |  4/6/8           srecNoAddress, srecDataAddress, srecRecCount, srecStartAddress, (srecAddressFieldUnknown)
     18 "  +----------+
     19 "  | data     |  0..504/502/500  srecDataOdd, srecDataEven, (srecDataUnexpected)
     20 "  +----------+
     21 "  | checksum |  2               srecChecksum
     22 "  +----------+
     23 "
     24 " States in parentheses in the upper format description indicate that they
     25 " should not appear in a valid file.
     26 
     27 " quit when a syntax file was already loaded
     28 if exists("b:current_syntax")
     29  finish
     30 endif
     31 
     32 syn match srecRecStart "^S"
     33 
     34 syn match srecRecTypeUnknown "^S."        contains=srecRecStart
     35 syn match srecRecType        "^S[0-35-9]" contains=srecRecStart
     36 
     37 syn match srecByteCount "^S.[0-9a-fA-F]\{2}"        contains=srecRecTypeUnknown nextgroup=srecAddressFieldUnknown,srecChecksum
     38 syn match srecByteCount "^S[0-35-9][0-9a-fA-F]\{2}" contains=srecRecType
     39 
     40 syn match srecAddressFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=srecAddressFieldUnknown,srecChecksum
     41 
     42 syn match srecNoAddress    "^S0[0-9a-fA-F]\{6}"  contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
     43 syn match srecDataAddress  "^S1[0-9a-fA-F]\{6}"  contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
     44 syn match srecDataAddress  "^S2[0-9a-fA-F]\{8}"  contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
     45 syn match srecDataAddress  "^S3[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum
     46 syn match srecRecCount     "^S5[0-9a-fA-F]\{6}"  contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
     47 syn match srecRecCount     "^S6[0-9a-fA-F]\{8}"  contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
     48 syn match srecStartAddress "^S7[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
     49 syn match srecStartAddress "^S8[0-9a-fA-F]\{8}"  contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
     50 syn match srecStartAddress "^S9[0-9a-fA-F]\{6}"  contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum
     51 
     52 " alternating highlight per byte for easier reading
     53 syn match srecDataOdd        "[0-9a-fA-F]\{2}" contained nextgroup=srecDataEven,srecChecksum
     54 syn match srecDataEven       "[0-9a-fA-F]\{2}" contained nextgroup=srecDataOdd,srecChecksum
     55 " data bytes which should not exist
     56 syn match srecDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=srecDataUnexpected,srecChecksum
     57 " Data digit pair regex usage also results in only highlighting the checksum
     58 " if the number of data characters is even.
     59 
     60 syn match srecChecksum "[0-9a-fA-F]\{2}$" contained
     61 
     62 " Define the default highlighting.
     63 " Only when an item doesn't have highlighting yet
     64 
     65 " The default methods for highlighting. Can be overridden later
     66 hi def link srecRecStart            srecRecType
     67 hi def link srecRecTypeUnknown      srecRecType
     68 hi def link srecRecType             WarningMsg
     69 hi def link srecByteCount           Constant
     70 hi def srecAddressFieldUnknown term=italic cterm=italic gui=italic
     71 hi def link srecNoAddress           DiffAdd
     72 hi def link srecDataAddress         Comment
     73 hi def link srecRecCount            srecNoAddress
     74 hi def link srecStartAddress        srecDataAddress
     75 hi def srecDataOdd             term=bold cterm=bold gui=bold
     76 hi def srecDataEven            term=NONE cterm=NONE gui=NONE
     77 hi def link srecDataUnexpected      Error
     78 hi def link srecChecksum            DiffChange
     79 
     80 
     81 let b:current_syntax = "srec"
     82 
     83 " vim: ts=8