mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
a trailing comma in argument list is not an error (PY-4016)
This commit is contained in:
@@ -157,6 +157,9 @@ public class FunctionParsing extends Parsing {
|
||||
}
|
||||
else {
|
||||
parameter.rollbackTo();
|
||||
if (atToken(endToken)) {
|
||||
break;
|
||||
}
|
||||
PsiBuilder.Marker invalidElements = myBuilder.mark();
|
||||
while (!atToken(endToken) && !atToken(PyTokenTypes.LINE_BREAK) && !atToken(PyTokenTypes.COMMA) && !atToken(null)) {
|
||||
nextToken();
|
||||
|
||||
2
python/testData/psi/TrailingCommaInArgList.py
Normal file
2
python/testData/psi/TrailingCommaInArgList.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def some_function(a,):
|
||||
pass
|
||||
16
python/testData/psi/TrailingCommaInArgList.txt
Normal file
16
python/testData/psi/TrailingCommaInArgList.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
PyFile:TrailingCommaInArgList.py
|
||||
PyFunction('some_function')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('some_function')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyNamedParameter('a')
|
||||
PsiElement(Py:IDENTIFIER)('a')
|
||||
PsiElement(Py:COMMA)(',')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyPassStatement
|
||||
PsiElement(Py:PASS_KEYWORD)('pass')
|
||||
@@ -271,6 +271,10 @@ public class PythonParsingTest extends ParsingTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTrailingCommaInArgList() { // PY-4016
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void doTest() {
|
||||
doTest(LanguageLevel.PYTHON25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user