Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
hex.vim90 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:	Intel HEX3" Maintainer:	Markus Heidelberg <markus.heidelberg@web.de>4" Previous version:	Sams Ricahrd <sams@ping.at>5" Last Change:	2015 Feb 246 7" Each record (line) is built as follows:8"9"    field       digits          states10"11"  +----------+12"  | start    |  1 (':')         hexRecStart13"  +----------+14"  | count    |  2               hexDataByteCount15"  +----------+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               hexChecksum23"  +----------+24"25" States in parentheses in the upper format description indicate that they26" should not appear in a valid file.27 28" quit when a syntax file was already loaded29if exists("b:current_syntax")30  finish31endif32 33syn match hexRecStart "^:"34 35syn match hexDataByteCount "^:[0-9a-fA-F]\{2}" contains=hexRecStart nextgroup=hexAddress36 37syn match hexAddress "[0-9a-fA-F]\{4}" transparent contained nextgroup=hexRecTypeUnknown,hexRecType38" The address field groups include the record type field in the last 239" characters, the proper match for highlighting follows below.40syn match hexAddressFieldUnknown "^:[0-9a-fA-F]\{8}"      contains=hexDataByteCount nextgroup=hexDataFieldUnknown,hexChecksum41syn match hexDataAddress         "^:[0-9a-fA-F]\{6}00"    contains=hexDataByteCount nextgroup=hexDataOdd,hexChecksum42syn match hexNoAddress           "^:[0-9a-fA-F]\{6}01"    contains=hexDataByteCount nextgroup=hexDataUnexpected,hexChecksum43syn match hexNoAddress           "^:[0-9a-fA-F]\{6}0[24]" contains=hexDataByteCount nextgroup=hexExtendedAddress44syn match hexNoAddress           "^:[0-9a-fA-F]\{6}0[35]" contains=hexDataByteCount nextgroup=hexStartAddress45 46syn match hexRecTypeUnknown "[0-9a-fA-F]\{2}" contained47syn match hexRecType        "0[0-5]"          contained48 49syn match hexDataFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=hexDataFieldUnknown,hexChecksum50" alternating highlight per byte for easier reading51syn match hexDataOdd          "[0-9a-fA-F]\{2}" contained nextgroup=hexDataEven,hexChecksum52syn match hexDataEven         "[0-9a-fA-F]\{2}" contained nextgroup=hexDataOdd,hexChecksum53" data bytes which should not exist54syn match hexDataUnexpected   "[0-9a-fA-F]\{2}" contained nextgroup=hexDataUnexpected,hexChecksum55" Data digit pair regex usage also results in only highlighting the checksum56" if the number of data characters is even.57 58" special data fields59syn match hexExtendedAddress "[0-9a-fA-F]\{4}" contained nextgroup=hexDataUnexpected,hexChecksum60syn match hexStartAddress    "[0-9a-fA-F]\{8}" contained nextgroup=hexDataUnexpected,hexChecksum61 62syn match hexChecksum "[0-9a-fA-F]\{2}$" contained63 64" Folding Data Records below an Extended Segment/Linear Address Record65syn region hexExtAdrBlock start="^:[0-9a-fA-F]\{7}[24]" skip="^:[0-9a-fA-F]\{7}0" end="^:"me=s-1 fold transparent66 67" Define the default highlighting.68" Only when an item doesn't have highlighting yet69 70" The default methods for highlighting. Can be overridden later71hi def link hexRecStart            hexRecType72hi def link hexDataByteCount       Constant73hi def hexAddressFieldUnknown term=italic cterm=italic gui=italic74hi def link hexDataAddress         Comment75hi def link hexNoAddress           DiffAdd76hi def link hexRecTypeUnknown      hexRecType77hi def link hexRecType             WarningMsg78hi def hexDataFieldUnknown    term=italic cterm=italic gui=italic79hi def hexDataOdd             term=bold cterm=bold gui=bold80hi def hexDataEven            term=NONE cterm=NONE gui=NONE81hi def link hexDataUnexpected      Error82hi def link hexExtendedAddress     hexDataAddress83hi def link hexStartAddress        hexDataAddress84hi def link hexChecksum            DiffChange85 86 87let b:current_syntax = "hex"88 89" vim: ts=890 
codekingpro/portable-devtools · Team Ai