4 " Maintainer: Chris Larson <kergoth@handhelds.org>
5 " Filenames: *.bb, *.bbclass
9 elseif exists("b:current_syntax")
15 syn match bbComment "^#.*$" display contains=bbTodo
16 syn keyword bbTodo TODO FIXME XXX contained
17 syn match bbDelimiter "[(){}=]" contained
18 syn match bbQuote /['"]/ contained
20 "syn region bbString matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ keepend contains=bbTodo
21 "syn region bbString matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ keepend contains=bbTodo
22 syn region bbString matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ contained keepend contains=bbTodo
23 syn region bbString matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ contained keepend contains=bbTodo
26 " syn keyword bbPythonFlag python contained nextgroup=bbFunction
27 " syn region bbPythonFuncRegion start="^python\s\+\w\+\s*()\s*{" end="^}$" keepend contains=bbPythonFuncDef
28 " syn match bbPythonFuncDef "^python\s\+\w\+\s*()\s*{" contained contains=bbPythonFlag
29 " hi def link bbPythonFuncRegion Comment
30 " hi def link bbPythonFlag Type
33 " syn keyword bbPythonFlag python contained nextgroup=bbFunction
34 " syn match bbPythonFuncDef "^python\s\+\w\+\s*()\s*{" contained contains=bbPythonFlag,bbFunction,bbDelimiter
35 " syn region bbPythonFuncRegion start="^python\s\+\w\+\s*()\s*{" end="^}$" keepend contains=bbPythonFuncDef,bbDelimiter
36 " hi def link bbPythonFuncRegion Comment
37 " hi def link bbPythonFlag Type
40 " syn keyword bbPythonFlag python contained nextgroup=bbFunction
41 " syn match bbPythonFuncDef "^\(python\s\+\w\+\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion
42 " syn region bbPythonFuncRegion matchgroup=bbDelimiter start="{" end="^}$" keepend contained
43 " hi def link bbPythonFuncRegion Comment
44 " hi def link bbPythonFlag Type
46 " BitBake variable metadata
47 syn match bbVarDef "^\([a-zA-Z0-9\-_]\+\)\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
48 syn match bbIdentifier "[a-zA-Z0-9\-_]\+" display contained
49 "syn keyword bbVarEq = display contained nextgroup=bbVarValue
50 syn match bbVarEq "=" contained contains=bbOperator nextgroup=bbVarValue
51 syn match bbVarValue ".*$" contained contains=bbString
54 " BitBake variable metadata flags
55 syn match bbVarFlagDef "^\([a-zA-Z0-9\-_]\+\)\(\[[a-zA-Z0-9\-_]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
56 syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
57 "syn match bbVarFlagFlag "\[\([a-zA-Z0-9\-_]\+\)\]\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
61 syn match bbFunction "\h\w*" display contained
64 " BitBake python metadata
65 syn include @python syntax/python.vim
66 if exists("b:current_syntax")
67 unlet b:current_syntax
70 syn keyword bbPythonFlag python contained nextgroup=bbFunction
71 syn match bbPythonFuncDef "^\(python\s\+\w\+\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion
72 syn region bbPythonFuncRegion matchgroup=bbDelimiter start="{" end="^}$" keepend contained contains=@python
73 "hi def link bbPythonFuncRegion Comment
76 " BitBake shell metadata
77 syn include @shell syntax/sh.vim
78 if exists("b:current_syntax")
79 unlet b:current_syntax
82 syn match bbShellFuncDef "^\(\w\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbFunction,bbDelimiter nextgroup=bbShellFuncRegion
83 syn region bbShellFuncRegion matchgroup=bbDelimiter start="{" end="^}$" keepend contained contains=@shell
84 "hi def link bbShellFuncRegion Comment
87 " BitBake 'def'd python functions
88 syn keyword bbDef def contained
90 syn match bbDefCmd "^def" contains=bbDef skipwhite nextgroup=bbDefFunc
91 syn match bbDefFunc "\w\+" contains=bbFunction contained skipwhite nextgroup=bbDefArgs
92 syn region bbDefArgs matchgroup=bbDelimiter start="(" end=")" excludenl contained skipwhite keepend contains=bbIdentifier nextgroup=bbDefRegion
93 syn region bbDefRegion start=":$" end='^$' end='^\(\s\)\@!' contained contains=@python
97 syn keyword bbStatement include inherit addtask addhandler
99 syn match bbArrayBrackets "[\[\]]" contained
100 hi def link bbArrayBrackets Statement
102 hi def link bbDef Statement
103 hi def link bbPythonFlag Type
104 hi def link bbStatement Statement
105 hi def link bbString String
106 hi def link bbTodo Todo
107 hi def link bbComment Comment
108 hi def link bbOperator Operator
109 hi def link bbError Error
110 hi def link bbFunction Function
111 hi def link bbDelimiter Delimiter
112 hi def link bbIdentifier Identifier
113 hi def link bbQuote Statement
114 hi def link bbVarEq Operator
116 let b:current_syntax = "bb"