]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(bitbake): fix multiline Python function parameter syntax
authorMartin Schwan <m.schwan@phytec.de>
Mon, 13 Oct 2025 18:50:20 +0000 (18:50 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 13 Oct 2025 18:50:20 +0000 (18:50 +0000)
Fix syntax highlighting for def-style Python functions, with their
parameters spanning multiple lines. E.g. the following should match as
valid Python code in Bitbake recipes:

    def myFunction(one, two, \
                   three, four):
        pass

For this to work, use the prefix modifier "\_" before the wildcard ".",
to also match newline characters.

closes: #18565

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/bitbake.vim

index 30f34474ad849bb9479c2c9d29171b81a919d4c8..5e9bc582908284c3b437161267de0df3687c4305 100644 (file)
@@ -4,6 +4,8 @@
 "               Ricardo Salveti <rsalveti@rsalveti.net>
 " Copyright:    Copyright (C) 2004  Chris Larson <kergoth@handhelds.org>
 "               Copyright (C) 2008  Ricardo Salveti <rsalveti@rsalveti.net>
+" Last Change:  2022 Jul 25
+" 2025 Oct 13 by Vim project: update multiline function syntax #18565
 "
 " This file is licensed under the MIT license, see COPYING.MIT in
 " this source distribution for the terms.
@@ -95,7 +97,7 @@ syn region bbPyFuncRegion       matchgroup=bbDelimiter start="{\s*$" end="^}\s*$
 
 " BitBake 'def'd python functions
 syn keyword bbPyDef             def contained
-syn region bbPyDefRegion        start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python
+syn region bbPyDefRegion        start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(\_.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python
 
 " Highlighting Definitions
 hi def link bbUnmatched         Error