robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
ab20681c52
master
1" Vim syntax file 2" Language: dts/dtsi (device tree files) 3" Maintainer: Daniel Mack <vim@zonque.org> 4" Last Change: 2023 Apr 28 5 6if exists ( "b:current_syntax" ) 7finish 8endif 9let b: current_syntax = 'dts' 10 11syntax region dtsComment start = "/\* "end = "\*/ " 12syntax match dtsReference "& [ [:alpha: ][ :digit: ] _]\+ " 13syntax match dtsReference "&{ [ [:alpha: ][ :digit: ] @_/-]\+} " 14syntax region dtsBinaryProperty start = "\[ "end = "\] " 15syntax match dtsStringProperty "\". * \" " 16syntax match dtsKeyword "/ [ [:alpha: ][ :digit: ] -]\+/\( [ [:space: ] ]\|;\) "he= e-1 17syntax match dtsLabel "^ [ [:space: ] ] * [ [:alpha: ][ :digit: ] _]\+: " 18syntax matchdtsNode /[ [:alpha:][ :digit:] -_]\+ \(@ [ 0-9a-fA-F ] \+\|\) [ [:space: ] ] * {/he=e-1 19syntax region dtsCellProperty start = "< "end = "> "contains = dtsReference , dtsBinaryProperty , dtsStringProperty , dtsComment 20syntax region dtsCommentInner start = "/\* "end = "\*/ " 21syntax match dtsCommentLine "//. * $ " 22 23" Accept %: for # (C99) 24syn region cPreCondit start = "^\s * \zs\(%:\|#\)\s * \(if\|ifdef\|ifndef\|elif\)\> "skip = "\\$ "end = "$ "keepend contains = cComment , cCommentL , cCppString , cCharacter , cCppParen , cParenError , cNumbers , cCommentError , cSpaceError 25syn match cPreConditMatch display "^\s * \zs\(%:\|#\)\s * \(else\|endif\)\> " 26if ! exists ( "c_no_if0" ) 27syn cluster cCppOutInGroup contains = cCppInIf , cCppInElse , cCppInElse2 , cCppOutIf , cCppOutIf2 , cCppOutElse , cCppInSkip , cCppOutSkip 28syn region cCppOutWrapper start = "^\s * \zs\(%:\|#\)\s * if\s\+0\+\s * \($\|//\|/\*\|&\) "end = ".\@=\|$ "contains = cCppOutIf , cCppOutElse , @NoSpell fold 29syn region cCppOutIf contained start = "0\+ "matchgroup = cCppOutWrapper end = "^\s * \(%:\|#\)\s * endif\> "contains = cCppOutIf2 , cCppOutElse 30if ! exists ( "c_no_if0_fold" ) 31syn region cCppOutIf2 contained matchgroup = cCppOutWrapper start = "0\+ "end = "^\s * \(%:\|#\)\s * \(else\>\|elif\s\+\(0\+\s * \($\|//\|/\*\|&\)\)\@!\|endif\>\) "me= s-1contains = cSpaceError , cCppOutSkip , @Spell fold 32else 33syn region cCppOutIf2 contained matchgroup = cCppOutWrapper start = "0\+ "end = "^\s * \(%:\|#\)\s * \(else\>\|elif\s\+\(0\+\s * \($\|//\|/\*\|&\)\)\@!\|endif\>\) "me= s-1contains = cSpaceError , cCppOutSkip , @Spell 34endif 35syn region cCppOutElse contained matchgroup = cCppOutWrapper start = "^\s * \(%:\|#\)\s * \(else\|elif\) "end = "^\s * \(%:\|#\)\s * endif\> "me= s-1contains = TOP , cPreCondit 36syn region cCppInWrapper start = "^\s * \zs\(%:\|#\)\s * if\s\+0 * [ 1-9 ] \d * \s * \($\|//\|/\*\||\) "end = ".\@=\|$ "contains = cCppInIf , cCppInElse fold 37syn region cCppInIf contained matchgroup = cCppInWrapper start = "\d\+ "end = "^\s * \(%:\|#\)\s * endif\> "contains = TOP , cPreCondit 38if ! exists ( "c_no_if0_fold" ) 39syn region cCppInElse contained start = "^\s * \(%:\|#\)\s * \(else\>\|elif\s\+\(0 * [ 1-9 ] \d * \s * \($\|//\|/\*\||\)\)\@!\) "end = ".\@=\|$ "containedin = cCppInIf contains = cCppInElse2 fold 40else 41syn region cCppInElse contained start = "^\s * \(%:\|#\)\s * \(else\>\|elif\s\+\(0 * [ 1-9 ] \d * \s * \($\|//\|/\*\||\)\)\@!\) "end = ".\@=\|$ "containedin = cCppInIf contains = cCppInElse2 42endif 43syn region cCppInElse2 contained matchgroup = cCppInWrapper start = "^\s * \(%:\|#\)\s * \(else\|elif\)\( [ ^/ ] \|/ [ ^/* ] \) * "end = "^\s * \(%:\|#\)\s * endif\> "me= s-1contains = cSpaceError , cCppOutSkip , @Spell 44syn region cCppOutSkip contained start = "^\s * \(%:\|#\)\s * \(if\>\|ifdef\>\|ifndef\>\) "skip = "\\$ "end = "^\s * \(%:\|#\)\s * endif\> "contains = cSpaceError , cCppOutSkip 45syn 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 46endif 47syn region cIncluded display contained start = +" +skip = +\\\\\|\\" +end = +" + 48syn match cIncluded display contained "< [ ^> ] * > " 49syn match cInclude display "^\s * \zs\(%:\|#\)\s * include\>\s * [ "< ] "contains = cIncluded 50"syn match cLineSkip "\\$" 51syn 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 52syn region cDefine start = "^\s * \zs\(%:\|#\)\s * \(define\|undef\)\> "skip = "\\$ "end = "$ "keepend contains = ALLBUT , @cPreProcGroup , @Spell 53syn region cPreProc start = "^\s * \zs\(%:\|#\)\s * \(pragma\>\|line\>\|warning\>\|warn\>\|error\>\) "skip = "\\$ "end = "$ "keepend contains = ALLBUT , @cPreProcGroup , @Spell 54 55hi def link dtsCellProperty Number 56hi def link dtsBinaryProperty Number 57hi def link dtsStringProperty String 58hi def link dtsKeyword Include 59hi def link dtsLabel Label 60hi def link dtsNode Structure 61hi def link dtsReference Macro 62hi def link dtsComment Comment 63hi def link dtsCommentInner Comment 64hi def link dtsCommentLine Comment 65 66hi def link cInclude Include 67hi def link cPreProc PreProc 68hi def link cDefine Macro 69hi def link cIncluded cString 70hi def link cString String 71 72hi def link cCppInWrapper cCppOutWrapper 73hi def link cCppOutWrapper cPreCondit 74hi def link cPreConditMatch cPreCondit 75hi def link cPreCondit PreCondit 76hi def link cCppOutSkip cCppOutIf2 77 78hi def link cCppInElse2 cCppOutIf2 79hi def link cCppOutIf2 cCppOut 80hi def link cCppOut Comment