summaryrefslogtreecommitdiffstats
path: root/bitbake/contrib/vim/syntax/bitbake.vim
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/contrib/vim/syntax/bitbake.vim')
-rw-r--r--bitbake/contrib/vim/syntax/bitbake.vim195
1 files changed, 95 insertions, 100 deletions
diff --git a/bitbake/contrib/vim/syntax/bitbake.vim b/bitbake/contrib/vim/syntax/bitbake.vim
index be55980b3a..b46436a567 100644
--- a/bitbake/contrib/vim/syntax/bitbake.vim
+++ b/bitbake/contrib/vim/syntax/bitbake.vim
@@ -1,127 +1,122 @@
1" Vim syntax file 1" Vim syntax file
2" Language: BitBake bb/bbclasses/inc
3" Author: Chris Larson <kergoth@handhelds.org>
4" Ricardo Salveti <rsalveti@rsalveti.net>
5" Copyright: Copyright (C) 2004 Chris Larson <kergoth@handhelds.org>
6" Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net>
2" 7"
3" Copyright (C) 2004 Chris Larson <kergoth@handhelds.org>
4" This file is licensed under the MIT license, see COPYING.MIT in 8" This file is licensed under the MIT license, see COPYING.MIT in
5" this source distribution for the terms. 9" this source distribution for the terms.
6" 10"
7" Language: BitBake 11" Syntax highlighting for bb, bbclasses and inc files.
8" Maintainer: Chris Larson <kergoth@handhelds.org>
9" Filenames: *.bb, *.bbclass
10
11if version < 600
12 syntax clear
13elseif exists("b:current_syntax")
14 finish
15endif
16
17syn case match
18
19" Catch incorrect syntax (only matches if nothing else does)
20" 12"
21syn match bbUnmatched "." 13" It's an entirely new type, just has specific syntax in shell and python code
22
23 14
24syn include @python syntax/python.vim 15if &compatible || v:version < 600
16 finish
17endif
25if exists("b:current_syntax") 18if exists("b:current_syntax")
26 unlet b:current_syntax 19 finish
27endif 20endif
28 21
22" BitBake syntax
29 23
30" Other 24" Matching case
31 25syn case match
32syn match bbComment "^#.*$" display contains=bbTodo
33syn keyword bbTodo TODO FIXME XXX contained
34syn match bbDelimiter "[(){}=]" contained
35syn match bbQuote /['"]/ contained
36syn match bbArrayBrackets "[\[\]]" contained
37
38
39" BitBake strings
40
41syn match bbContinue "\\$"
42syn region bbString matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ contained keepend contains=bbTodo,bbContinue,bbVarInlinePy,bbVarDeref
43syn region bbString matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ contained keepend contains=bbTodo,bbContinue,bbVarInlinePy,bbVarDeref
44
45" BitBake variable metadata
46
47syn match bbVarBraces "[\${}]"
48syn region bbVarDeref matchgroup=bbVarBraces start="${" end="}" contained
49" syn region bbVarDeref start="${" end="}" contained
50" syn region bbVarInlinePy start="${@" end="}" contained contains=@python
51syn region bbVarInlinePy matchgroup=bbVarBraces start="${@" end="}" contained contains=@python
52
53syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
54" syn match bbVarDeref "${[a-zA-Z0-9\-_\.]\+}" contained
55syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.]\+\(_[${}a-zA/-Z0-9\-_\.]\+\)\?\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq
56
57syn match bbIdentifier "[a-zA-Z0-9\-_\./]\+" display contained
58"syn keyword bbVarEq = display contained nextgroup=bbVarValue
59syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)" contained nextgroup=bbVarValue
60syn match bbVarValue ".*$" contained contains=bbString
61
62" BitBake variable metadata flags
63syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
64syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
65"syn match bbVarFlagFlag "\[\([a-zA-Z0-9\-_\.]\+\)\]\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
66
67
68" Functions!
69syn match bbFunction "\h\w*" display contained
70 26
27" Indicates the error when nothing is matched
28syn match bbUnmatched "."
71 29
72" BitBake python metadata 30" Comments
31syn cluster bbCommentGroup contains=bbTodo,@Spell
32syn keyword bbTodo COMBAK FIXME TODO XXX contained
33syn match bbComment "#.*$" contains=@bbCommentGroup
73 34
74syn keyword bbPythonFlag python contained nextgroup=bbFunction 35" String helpers
75syn match bbPythonFuncDef "^\(python\s\+\)\(\w\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion skipwhite 36syn match bbQuote +['"]+ contained
76syn region bbPythonFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@python 37syn match bbDelimiter "[(){}=]" contained
77"hi def link bbPythonFuncRegion Comment 38syn match bbArrayBrackets "[\[\]]" contained
78 39
40" BitBake strings
41syn match bbContinue "\\$"
42syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ excludenl end=+"+ contained keepend contains=bbTodo,bbContinue,bbVarDeref,@Spell
43syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ excludenl end=+'+ contained keepend contains=bbTodo,bbContinue,bbVarDeref,@Spell
44
45" Vars definition
46syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
47syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained
48syn match bbVarDeref "${[a-zA-Z0-9\-_\.\/\+]\+}" contained
49syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)" contained nextgroup=bbVarValue
50syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+]\+\(_[${}a-zA-Z0-9\-_\.\/\+]\+\)\?\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq
51syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue
52syn match bbVarPyValue "${@[a-zA-Z0-9\-_\.\(\)]\+}" contained
53
54" Vars metadata flags
55syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
56syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
57
58" Includes and requires
59syn keyword bbInclude inherit include require contained
60syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref
61syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest
62
63" Add taks and similar
64syn keyword bbStatement addtask addhandler after before EXPORT_FUNCTIONS contained
65syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement
66syn match bbStatementLine "^\(addtask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
67
68" OE Important Functions
69syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained
70
71" Generic Functions
72syn match bbFunction "\h[0-9A-Za-z_-]*" display contained contains=bbOEFunctions
79 73
80" BitBake shell metadata 74" BitBake shell metadata
81syn include @shell syntax/sh.vim 75syn include @shell syntax/sh.vim
82if exists("b:current_syntax") 76if exists("b:current_syntax")
83 unlet b:current_syntax 77 unlet b:current_syntax
84endif 78endif
79syn keyword bbShFakeRootFlag fakeroot contained
80syn match bbShFuncDef "^\(fakeroot\s*\)\?\([0-9A-Za-z_}${-]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbDelimiter nextgroup=bbShFuncRegion skipwhite
81syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@shell
85 82
86syn keyword bbFakerootFlag fakeroot contained nextgroup=bbFunction 83" BitBake python metadata
87syn match bbShellFuncDef "^\(fakeroot\s*\)\?\(\w\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbFakerootFlag,bbFunction,bbDelimiter nextgroup=bbShellFuncRegion skipwhite 84syn include @python syntax/python.vim
88syn region bbShellFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@shell 85if exists("b:current_syntax")
89"hi def link bbShellFuncRegion Comment 86 unlet b:current_syntax
90 87endif
88syn keyword bbPyFlag python contained
89syn match bbPyFuncDef "^\(python\s\+\)\([0-9A-Za-z_-]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPyFlag,bbFunction,bbDelimiter nextgroup=bbPyFuncRegion skipwhite
90syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@python
91 91
92" BitBake 'def'd python functions 92" BitBake 'def'd python functions
93syn keyword bbDef def contained 93syn keyword bbPyDef def contained
94syn region bbDefRegion start='^def\s\+\w\+\s*([^)]*)\s*:\s*$' end='^\(\s\|$\)\@!' contains=@python 94syn region bbPyDefRegion start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python
95
96" Highlighting Definitions
97hi def link bbUnmatched Error
98hi def link bbInclude Include
99hi def link bbTodo Todo
100hi def link bbComment Comment
101hi def link bbQuote String
102hi def link bbString String
103hi def link bbDelimiter Keyword
104hi def link bbArrayBrackets Statement
105hi def link bbContinue Special
106hi def link bbExportFlag Type
107hi def link bbIdentifier Identifier
108hi def link bbVarDeref PreProc
109hi def link bbVarDef Identifier
110hi def link bbVarValue String
111hi def link bbShFakeRootFlag Type
112hi def link bbFunction Function
113hi def link bbPyFlag Type
114hi def link bbPyDef Statement
115hi def link bbStatement Statement
116hi def link bbStatementRest Identifier
117hi def link bbOEFunctions Special
118hi def link bbVarPyValue PreProc
95 119
120let b:current_syntax = "bb"
96 121
97" BitBake statements
98syn keyword bbStatement include inherit require addtask addhandler EXPORT_FUNCTIONS display contained
99syn match bbStatementLine "^\(include\|inherit\|require\|addtask\|addhandler\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
100syn match bbStatementRest ".*$" contained contains=bbString,bbVarDeref
101
102" Highlight
103"
104hi def link bbArrayBrackets Statement
105hi def link bbUnmatched Error
106hi def link bbContinue Special
107hi def link bbDef Statement
108hi def link bbPythonFlag Type
109hi def link bbExportFlag Type
110hi def link bbFakerootFlag Type
111hi def link bbStatement Statement
112hi def link bbString String
113hi def link bbTodo Todo
114hi def link bbComment Comment
115hi def link bbOperator Operator
116hi def link bbError Error
117hi def link bbFunction Function
118hi def link bbDelimiter Delimiter
119hi def link bbIdentifier Identifier
120hi def link bbVarEq Operator
121hi def link bbQuote String
122hi def link bbVarValue String
123" hi def link bbVarInlinePy PreProc
124hi def link bbVarDeref PreProc
125hi def link bbVarBraces PreProc
126 122
127let b:current_syntax = "bb"