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