Fix Python FunctionList absorbing next function issue if space after colon

Allow spaces between ':' and EOL.

Fix #16636, close #16637
This commit is contained in:
PeterCJ 2025-06-05 10:39:56 -07:00 committed by Don Ho
parent 8435308b02
commit 1911875411
4 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,11 @@
def func1(a,b):
pass
def func2(a,b):
pass
def func3(a,b):
pass
def func4(a,b):
pass

View File

@ -0,0 +1 @@
{"leaves":["func1(a,b)","func2(a,b)","func3(a,b)","func4(a,b)"],"root":"unitTest"}

View File

@ -0,0 +1 @@
{"leaves":["func1(a,b)","func2(a,b)","func3(a,b)","func4(a,b)"],"root":"unitTest"}

View File

@ -22,7 +22,7 @@
<nameExpr expr="\w+(?=\s*[\(|:])" />
</className>
<function
mainExpr="\s(async )?def\x20\K.+?(?=(:$|,$|:\s*#))"
mainExpr="\s(async )?def\x20\K.+?(?=(:\h*$|,\h*$|:\s*#))"
>
<functionName>
<funcNameExpr expr=".*" />
@ -30,7 +30,7 @@
</function>
</classRange>
<function
mainExpr="^(async )?def\x20\K.+?(?=(:$|,$|:\s*#))"
mainExpr="^(async )?def\x20\K.+?(?=(:\h*$|,\h*$|:\s*#))"
>
<functionName>
<nameExpr expr=".*" />