29450
|
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>
|
|
7 "
|
|
8 " This file is licensed under the MIT license, see COPYING.MIT in
|
|
9 " this source distribution for the terms.
|
|
10 "
|
|
11 " Syntax highlighting for bb, bbclasses and inc files.
|
|
12 "
|
|
13 " It's an entirely new type, just has specific syntax in shell and python code
|
|
14
|
|
15 if v:version < 600
|
|
16 finish
|
|
17 endif
|
|
18 if exists("b:current_syntax")
|
|
19 finish
|
|
20 endif
|
|
21
|
|
22 syn include @python syntax/python.vim
|
|
23 unlet! b:current_syntax
|
|
24
|
|
25 " BitBake syntax
|
|
26
|
|
27 " Matching case
|
|
28 syn case match
|
|
29
|
|
30 " Indicates the error when nothing is matched
|
|
31 syn match bbUnmatched "."
|
|
32
|
|
33 " Comments
|
|
34 syn cluster bbCommentGroup contains=bbTodo,@Spell
|
|
35 syn keyword bbTodo COMBAK FIXME TODO XXX contained
|
|
36 syn match bbComment "#.*$" contains=@bbCommentGroup
|
|
37
|
|
38 " String helpers
|
|
39 syn match bbQuote +['"]+ contained
|
|
40 syn match bbDelimiter "[(){}=]" contained
|
|
41 syn match bbArrayBrackets "[\[\]]" contained
|
|
42
|
|
43 " BitBake strings
|
|
44 syn match bbContinue "\\$"
|
|
45 syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ end=+"+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell
|
|
46 syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ end=+'+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell
|
|
47
|
|
48 " Vars definition
|
|
49 syn match bbExport "^export" nextgroup=bbIdentifier skipwhite
|
|
50 syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
|
|
51 syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained
|
|
52 syn match bbVarDeref "${[a-zA-Z0-9\-_:\.\/\+]\+}" contained
|
|
53 syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue
|
|
54 syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+][${}a-zA-Z0-9\-_:\.\/\+]*\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbOverrideOperator,bbVarDeref nextgroup=bbVarEq
|
|
55 syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue
|
|
56 syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python
|
|
57
|
|
58 " Vars metadata flags
|
|
59 syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.+]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
|
|
60 syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq
|
|
61
|
|
62 " Includes and requires
|
|
63 syn keyword bbInclude inherit include require contained
|
|
64 syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref
|
|
65 syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest
|
|
66
|
|
67 " Add taks and similar
|
|
68 syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained
|
|
69 syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement
|
|
70 syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
|
|
71
|
|
72 " OE Important Functions
|
|
73 syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained
|
|
74
|
|
75 " Generic Functions
|
|
76 syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions
|
|
77
|
|
78 syn keyword bbOverrideOperator append prepend remove contained
|
|
79
|
|
80 " BitBake shell metadata
|
|
81 syn include @shell syntax/sh.vim
|
|
82 unlet! b:current_syntax
|
|
83
|
|
84 syn keyword bbShFakeRootFlag fakeroot contained
|
|
85 syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_:${}\-\.]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbOverrideOperator,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite
|
|
86 syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell
|
|
87
|
|
88 " Python value inside shell functions
|
|
89 syn region shDeref start=+${@+ skip=+\\$+ excludenl end=+}+ contained contains=@python
|
|
90
|
|
91 " BitBake python metadata
|
|
92 syn keyword bbPyFlag python contained
|
|
93 syn match bbPyFuncDef "^\(fakeroot\s*\)\?\(python\)\(\s\+[0-9A-Za-z_:${}\-\.]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbPyFlag,bbFunction,bbOverrideOperator,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite
|
|
94 syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python
|
|
95
|
|
96 " BitBake 'def'd python functions
|
|
97 syn keyword bbPyDef def contained
|
|
98 syn region bbPyDefRegion start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python
|
|
99
|
|
100 " Highlighting Definitions
|
|
101 hi def link bbUnmatched Error
|
|
102 hi def link bbInclude Include
|
|
103 hi def link bbTodo Todo
|
|
104 hi def link bbComment Comment
|
|
105 hi def link bbQuote String
|
|
106 hi def link bbString String
|
|
107 hi def link bbDelimiter Keyword
|
|
108 hi def link bbArrayBrackets Statement
|
|
109 hi def link bbContinue Special
|
|
110 hi def link bbExport Type
|
|
111 hi def link bbExportFlag Type
|
|
112 hi def link bbIdentifier Identifier
|
|
113 hi def link bbVarDeref PreProc
|
|
114 hi def link bbVarDef Identifier
|
|
115 hi def link bbVarValue String
|
|
116 hi def link bbShFakeRootFlag Type
|
|
117 hi def link bbFunction Function
|
|
118 hi def link bbPyFlag Type
|
|
119 hi def link bbPyDef Statement
|
|
120 hi def link bbStatement Statement
|
|
121 hi def link bbStatementRest Identifier
|
|
122 hi def link bbOEFunctions Special
|
|
123 hi def link bbVarPyValue PreProc
|
|
124 hi def link bbOverrideOperator Operator
|
|
125
|
|
126 let b:current_syntax = "bitbake"
|