10c5fa7d7SBram Moolenaar" Vim syntax file 20c5fa7d7SBram Moolenaar" Language: dts/dtsi (device tree files) 30c5fa7d7SBram Moolenaar" Maintainer: Daniel Mack <[email protected]> 4*3ec3217fSBram Moolenaar" Last Change: 2021 May 15 50c5fa7d7SBram Moolenaar 60c5fa7d7SBram Moolenaarif exists("b:current_syntax") 70c5fa7d7SBram Moolenaar finish 80c5fa7d7SBram Moolenaarendif 90c5fa7d7SBram Moolenaar 100c5fa7d7SBram Moolenaarsyntax region dtsComment start="/\*" end="\*/" 110c5fa7d7SBram Moolenaarsyntax match dtsReference "&[[:alpha:][:digit:]_]\+" 120c5fa7d7SBram Moolenaarsyntax region dtsBinaryProperty start="\[" end="\]" 130c5fa7d7SBram Moolenaarsyntax match dtsStringProperty "\".*\"" 14d5d015d4SBram Moolenaarsyntax match dtsKeyword "/.\{-1,\}/" 150c5fa7d7SBram Moolenaarsyntax match dtsLabel "^[[:space:]]*[[:alpha:][:digit:]_]\+:" 16bf88493cSBram Moolenaarsyntax match dtsNode /[[:alpha:][:digit:]-_]\+\(@[0-9a-fA-F]\+\|\)[[:space:]]*{/he=e-1 170c5fa7d7SBram Moolenaarsyntax region dtsCellProperty start="<" end=">" contains=dtsReference,dtsBinaryProperty,dtsStringProperty,dtsComment 180c5fa7d7SBram Moolenaarsyntax region dtsCommentInner start="/\*" end="\*/" 19d5d015d4SBram Moolenaarsyntax match dtsCommentLine "//.*$" 200c5fa7d7SBram Moolenaar 21*3ec3217fSBram Moolenaar" Accept %: for # (C99) 22*3ec3217fSBram Moolenaarsyn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError 23*3ec3217fSBram Moolenaarsyn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>" 24*3ec3217fSBram Moolenaarif !exists("c_no_if0") 25*3ec3217fSBram Moolenaar syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip 26*3ec3217fSBram Moolenaar syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold 27*3ec3217fSBram Moolenaar syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse 28*3ec3217fSBram Moolenaar if !exists("c_no_if0_fold") 29*3ec3217fSBram Moolenaar syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold 30*3ec3217fSBram Moolenaar else 31*3ec3217fSBram Moolenaar syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell 32*3ec3217fSBram Moolenaar endif 33*3ec3217fSBram Moolenaar syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit 34*3ec3217fSBram Moolenaar syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold 35*3ec3217fSBram Moolenaar syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit 36*3ec3217fSBram Moolenaar if !exists("c_no_if0_fold") 37*3ec3217fSBram Moolenaar syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold 38*3ec3217fSBram Moolenaar else 39*3ec3217fSBram Moolenaar syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 40*3ec3217fSBram Moolenaar endif 41*3ec3217fSBram Moolenaar syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell 42*3ec3217fSBram Moolenaar syn region cCppOutSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip 43*3ec3217fSBram Moolenaar syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc 44*3ec3217fSBram Moolenaarendif 45*3ec3217fSBram Moolenaarsyn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ 46*3ec3217fSBram Moolenaarsyn match cIncluded display contained "<[^>]*>" 47*3ec3217fSBram Moolenaarsyn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded 48*3ec3217fSBram Moolenaar"syn match cLineSkip "\\$" 49*3ec3217fSBram Moolenaarsyn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock 50*3ec3217fSBram Moolenaarsyn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell 51*3ec3217fSBram Moolenaarsyn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell 52*3ec3217fSBram Moolenaar 530c5fa7d7SBram Moolenaarhi def link dtsCellProperty Number 540c5fa7d7SBram Moolenaarhi def link dtsBinaryProperty Number 550c5fa7d7SBram Moolenaarhi def link dtsStringProperty String 560c5fa7d7SBram Moolenaarhi def link dtsKeyword Include 570c5fa7d7SBram Moolenaarhi def link dtsLabel Label 58ac7bd638SBram Moolenaarhi def link dtsNode Structure 590c5fa7d7SBram Moolenaarhi def link dtsReference Macro 600c5fa7d7SBram Moolenaarhi def link dtsComment Comment 610c5fa7d7SBram Moolenaarhi def link dtsCommentInner Comment 62d5d015d4SBram Moolenaarhi def link dtsCommentLine Comment 63*3ec3217fSBram Moolenaar 64*3ec3217fSBram Moolenaarhi def link cInclude Include 65*3ec3217fSBram Moolenaarhi def link cPreProc PreProc 66*3ec3217fSBram Moolenaarhi def link cDefine Macro 67*3ec3217fSBram Moolenaarhi def link cIncluded cString 68*3ec3217fSBram Moolenaarhi def link cString String 69*3ec3217fSBram Moolenaar 70*3ec3217fSBram Moolenaarhi def link cCppInWrapper cCppOutWrapper 71*3ec3217fSBram Moolenaarhi def link cCppOutWrapper cPreCondit 72*3ec3217fSBram Moolenaarhi def link cPreConditMatch cPreCondit 73*3ec3217fSBram Moolenaarhi def link cPreCondit PreCondit 74*3ec3217fSBram Moolenaarhi def link cCppOutSkip cCppOutIf2 75*3ec3217fSBram Moolenaar 76*3ec3217fSBram Moolenaarhi def link cCppInElse2 cCppOutIf2 77*3ec3217fSBram Moolenaarhi def link cCppOutIf2 cCppOut 78*3ec3217fSBram Moolenaarhi def link cCppOut Comment 79