codekingpro/portable-devtools
115k
1" Vim syntax file2" Language: BitBake bb/bbclasses/inc3" 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" Last Change: 2022 Jul 258" 2025 Oct 13 by Vim project: update multiline function syntax #185659" 2026 Apr 07 by Vim project: update syntax script #1993110" 2026 Apr 15 by Vim project: allow forward-slashes in bitbake varflags #1998311"12" This file is licensed under the MIT license, see COPYING.MIT in13" this source distribution for the terms.14"15" Syntax highlighting for bb, bbclasses and inc files.16"17" It's an entirely new type, just has specific syntax in shell and python code18 19if v:version < 60020 finish21endif22if exists("b:current_syntax")23 finish24endif25 26syn include @python syntax/python.vim27unlet! b:current_syntax28 29" BitBake syntax30 31" Matching case32syn case match33 34" Indicates the error when nothing is matched35syn match bbUnmatched "."36 37" Comments38syn cluster bbCommentGroup contains=bbTodo,@Spell39syn keyword bbTodo COMBAK FIXME TODO XXX contained40syn match bbComment "#.*$" contains=@bbCommentGroup41 42" String helpers43syn match bbQuote +['"]+ contained 44syn match bbDelimiter "[(){}=]" contained45syn match bbArrayBrackets "[\[\]]" contained46 47" BitBake strings48syn match bbContinue "\\$"49syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ end=+"+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell50syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ end=+'+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell51 52" Vars definition53syn match bbExport "^export" nextgroup=bbIdentifier skipwhite54syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite55syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained56syn match bbVarDeref "${[a-zA-Z0-9\-_:\.\/\+]\+}" contained57syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue58syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+][${}a-zA-Z0-9\-_:\.\/\+]*\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbOverrideOperator,bbVarDeref nextgroup=bbVarEq59syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue60syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python61 62" Vars metadata flags63syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.+/]\+\)\(\[[a-zA-Z0-9\-_\.+/]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag64syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq65 66" Includes and requires67syn keyword bbInclude inherit inherit_defer include include_all require contained68syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref69syn match bbIncludeLine "^\(inherit\|inherit_defer\|include\|include_all\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest70 71" Add taks and similar72syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS addpylib contained73syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement74syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\|addpylib\)\s\+" contains=bbStatement nextgroup=bbStatementRest75 76" OE Important Functions77syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained78 79" Generic Functions80syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions81 82syn keyword bbOverrideOperator append prepend remove contained83 84" BitBake shell metadata85syn include @shell syntax/sh.vim86unlet! b:current_syntax87 88syn keyword bbShFakeRootFlag fakeroot contained89syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_:${}\-\.]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbOverrideOperator,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite90syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell91 92" Python value inside shell functions93syn region shDeref start=+${@+ skip=+\\$+ excludenl end=+}+ contained contains=@python94 95" BitBake python metadata96syn keyword bbPyFlag python contained97syn match bbPyFuncDef "^\(fakeroot\s*\)\?\(python\)\(\s\+[0-9A-Za-z_:${}\-\.]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbPyFlag,bbFunction,bbOverrideOperator,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite98syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python99 100" BitBake 'def'd python functions101syn keyword bbPyDef def contained102syn region bbPyDefRegion start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(\_.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python103 104" Highlighting Definitions105hi def link bbUnmatched Error106hi def link bbInclude Include107hi def link bbTodo Todo108hi def link bbComment Comment109hi def link bbQuote String110hi def link bbString String111hi def link bbDelimiter Keyword112hi def link bbArrayBrackets Statement113hi def link bbContinue Special114hi def link bbExport Type115hi def link bbExportFlag Type116hi def link bbIdentifier Identifier117hi def link bbVarDeref PreProc118hi def link bbVarDef Identifier119hi def link bbVarValue String120hi def link bbShFakeRootFlag Type121hi def link bbFunction Function122hi def link bbPyFlag Type123hi def link bbPyDef Statement124hi def link bbStatement Statement125hi def link bbStatementRest Identifier126hi def link bbOEFunctions Special127hi def link bbVarPyValue PreProc128hi def link bbOverrideOperator Operator129 130let b:current_syntax = "bitbake"131 