annotate runtime/syntax/bitbake.vim @ 31475:9ef91bdd1ab4 v9.0.1070

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