summaryrefslogtreecommitdiffstats
path: root/contrib/vim/syntax/bb.vim
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/vim/syntax/bb.vim')
-rw-r--r--contrib/vim/syntax/bb.vim15
1 files changed, 13 insertions, 2 deletions
diff --git a/contrib/vim/syntax/bb.vim b/contrib/vim/syntax/bb.vim
index 041561cca..3f59cbac4 100644
--- a/contrib/vim/syntax/bb.vim
+++ b/contrib/vim/syntax/bb.vim
@@ -22,8 +22,6 @@ syn match bbQuote /['"]/ contained
syn region bbString matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ contained keepend contains=bbTodo
syn region bbString matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ contained keepend contains=bbTodo
-syn match bbFunction "\h\w*" display contained
-
" First attempt:
" syn keyword bbPythonFlag python contained nextgroup=bbFunction
" syn region bbPythonFuncRegion start="^python\s\+\w\+\s*()\s*{" end="^}$" keepend contains=bbPythonFuncDef
@@ -52,6 +50,9 @@ syn match bbIdentifier "[a-zA-Z0-9\-_]\+" display contained
syn match bbVarEq "=" contained contains=bbOperator nextgroup=bbVarValue
syn match bbVarValue ".*$" contained contains=bbString
+" Functions!
+syn match bbFunction "\h\w*" display contained
+
" BitBake python metadata
syn include @python syntax/python.vim
if exists("b:current_syntax")
@@ -74,6 +75,16 @@ syn region bbShellFuncRegion matchgroup=bbDelimiter start="{" end="^}$" keepend
"hi def link bbShellFuncRegion Comment
+" BitBake 'def'd python functions
+syn keyword bbDef def contained
+
+syn match bbDefCmd "^def" skipwhite nextgroup=bbDefFunc
+syn match bbDefFunc "\w\+" contains=bbFunction contained skipwhite nextgroup=bbDefArgs
+syn region bbDefArgs matchgroup=bbDelimiter start="(" end=")" excludenl contained skipwhite keepend contains=bbIdentifier nextgroup=bbDefRegion
+syn region bbDefRegion start=":$" end='^$' end='^\(\s\)\@!' contained contains=@python
+
+hi def link bbDefCmd bbStatement
+
hi def link bbPythonFlag Type
hi def link bbStatement Statement
hi def link bbString String