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