summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorChris Larson <clarson@kergoth.com>2004-12-08 06:11:54 +0000
committerChris Larson <clarson@kergoth.com>2004-12-08 06:11:54 +0000
commitf1ef83662b095987915b54a9fe7c7b1582cc0f2f (patch)
tree31366ad30d6942053af7da9bd811c702570627f1 /contrib
parentfdb617fca0006d147f89fe02e8267c7d8ce4b69f (diff)
downloadbitbake-f1ef83662b095987915b54a9fe7c7b1582cc0f2f.tar.gz
Start adding vim syntax highlighting.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/vim/syntax/bb.vim74
1 files changed, 74 insertions, 0 deletions
diff --git a/contrib/vim/syntax/bb.vim b/contrib/vim/syntax/bb.vim
new file mode 100644
index 000000000..850ab8d17
--- /dev/null
+++ b/contrib/vim/syntax/bb.vim
@@ -0,0 +1,74 @@
+" Vim syntax file
+"
+" Language: BitBake
+" Maintainer: Chris Larson <kergoth@handhelds.org>
+" Filenames: *.bb, *.bbclass
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+syn case match
+
+syn match bbComment "^#.*$" display contains=bbTodo
+syn keyword bbTodo TODO FIXME XXX contained
+syn match bbDelimiter "[(){}=]" contained
+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 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
+" syn match bbPythonFuncDef "^python\s\+\w\+\s*()\s*{" contained contains=bbPythonFlag
+" hi def link bbPythonFuncRegion Comment
+" hi def link bbPythonFlag Type
+
+" Second attempt:
+" syn keyword bbPythonFlag python contained nextgroup=bbFunction
+" syn match bbPythonFuncDef "^python\s\+\w\+\s*()\s*{" contained contains=bbPythonFlag,bbFunction,bbDelimiter
+" syn region bbPythonFuncRegion start="^python\s\+\w\+\s*()\s*{" end="^}$" keepend contains=bbPythonFuncDef,bbDelimiter
+" hi def link bbPythonFuncRegion Comment
+" hi def link bbPythonFlag Type
+
+" Third attempt:
+" syn keyword bbPythonFlag python contained nextgroup=bbFunction
+" syn match bbPythonFuncDef "^\(python\s\+\w\+\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion
+" syn region bbPythonFuncRegion matchgroup=bbDelimiter start="{" end="^}$" keepend contained
+" hi def link bbPythonFuncRegion Comment
+" hi def link bbPythonFlag Type
+
+" BitBake variable metadata
+syn match bbVarDef "^\([a-zA-Z0-9\-_]\+\)\s*\(=\)\@=" contains=bbIdentifier 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 python metadata
+syn include @python syntax/python.vim
+
+syn keyword bbPythonFlag python contained nextgroup=bbFunction
+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
+hi def link bbPythonFlag Type
+
+hi def link bbStatement Statement
+hi def link bbString String
+hi def link bbTodo Todo
+hi def link bbComment Comment
+hi def link bbOperator Operator
+hi def link bbError Error
+hi def link bbFunction Function
+hi def link bbDelimiter Delimiter
+hi def link bbIdentifier Identifier
+hi def link bbQuote Statement
+hi def link bbVarEq Operator