Vim syntax update: Highlight overrides that include variable derefences (i.e. FILES_...
[vuplus_bitbake] / contrib / vim / syntax / bb.vim
index 3f59cba..4eded8b 100644 (file)
@@ -1,5 +1,9 @@
 " Vim syntax file
 "
+" Copyright (C) 2004  Chris Larson <kergoth@handhelds.org>
+" This file is licensed under the MIT license, see COPYING.MIT in
+" this source distribution for the terms.
+"
 " Language:    BitBake
 " Maintainer:  Chris Larson <kergoth@handhelds.org>
 " Filenames:   *.bb, *.bbclass
@@ -19,8 +23,9 @@ syn match bbQuote             /['"]/ contained
 
 "syn region bbString           matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ keepend contains=bbTodo
 "syn region bbString           matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ keepend contains=bbTodo
-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 bbContinue           "\\$"
+syn region bbString            matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ contained keepend contains=bbTodo,bbContinue
+syn region bbString            matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ contained keepend contains=bbTodo,bbContinue
 
 " First attempt:
 " syn keyword bbPythonFlag     python contained nextgroup=bbFunction
@@ -44,15 +49,25 @@ syn region bbString         matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ c
 " hi def link bbPythonFlag     Type
 
 " BitBake variable metadata
-syn match bbVarDef             "^\([a-zA-Z0-9\-_]\+\)\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
+syn match bbVarOverrideDeref   "[\${}()]"
+hi def link bbVarOverrideDeref         Statement
+syn match bbVarDef             "^\([a-zA-Z0-9\-_]\+\(_\(\${\)\?[a-zA-Z0-9\-_]\+\(}\)\?\)\?\)\s*\(=\)\@=" contains=bbIdentifier,bbVarOverrideDeref nextgroup=bbVarEq
 syn match bbIdentifier         "[a-zA-Z0-9\-_]\+" display contained
 "syn keyword bbVarEq   = display contained nextgroup=bbVarValue
 syn match bbVarEq              "=" contained contains=bbOperator nextgroup=bbVarValue
 syn match bbVarValue           ".*$" contained contains=bbString
 
+
+" BitBake variable metadata flags
+syn match bbVarFlagDef         "^\([a-zA-Z0-9\-_]\+\)\(\[[a-zA-Z0-9\-_]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
+syn region bbVarFlagFlag       matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
+"syn match bbVarFlagFlag               "\[\([a-zA-Z0-9\-_]\+\)\]\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
+
+
 " Functions!
 syn match bbFunction   "\h\w*" display contained
 
+
 " BitBake python metadata
 syn include @python syntax/python.vim
 if exists("b:current_syntax")
@@ -60,10 +75,11 @@ if exists("b:current_syntax")
 endif
 
 syn keyword bbPythonFlag       python contained nextgroup=bbFunction
-syn match bbPythonFuncDef      "^\(python\s\+\w\+\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion
+syn match bbPythonFuncDef      "^\(python\s\+\)\(\w\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion
 syn region bbPythonFuncRegion  matchgroup=bbDelimiter start="{" end="^}$" keepend contained contains=@python
 "hi def link bbPythonFuncRegion        Comment
 
+
 " BitBake shell metadata
 syn include @shell syntax/sh.vim
 if exists("b:current_syntax")
@@ -78,13 +94,20 @@ syn region bbShellFuncRegion        matchgroup=bbDelimiter start="{" end="^}$" keepend
 " BitBake 'def'd python functions
 syn keyword bbDef      def     contained
 
-syn match bbDefCmd             "^def" skipwhite nextgroup=bbDefFunc
+syn match bbDefCmd             "^def" contains=bbDef 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
+syn region bbDefRegion         matchgroup=bbDelimiter start=":$" end='^$' end='^\(\s\)\@!' contained contains=@python
+
+
+" BitBake statements
+syn keyword bbStatement                include inherit addtask addhandler
 
-hi def link bbDefCmd           bbStatement
+syn match bbArrayBrackets      "[\[\]]" contained
+hi def link bbArrayBrackets    Statement
 
+hi def link bbContinue         Special
+hi def link bbDef              Statement
 hi def link bbPythonFlag       Type
 hi def link bbStatement                Statement
 hi def link bbString           String