mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
comma between list literal elements is required (PY-1933)
This commit is contained in:
@@ -103,10 +103,10 @@ public class ExpressionParsing extends Parsing {
|
||||
}
|
||||
else {
|
||||
while (builder.getTokenType() != PyTokenTypes.RBRACKET) {
|
||||
if (builder.getTokenType() == PyTokenTypes.COMMA) {
|
||||
builder.advanceLexer();
|
||||
if (!matchToken(PyTokenTypes.COMMA)) {
|
||||
builder.error("expected ',' or ']'");
|
||||
}
|
||||
else if (!parseSingleExpression(isTargetExpression)) {
|
||||
if (!parseSingleExpression(isTargetExpression)) {
|
||||
builder.error(message("PARSE.expected.expr.or.comma.or.bracket"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
a = [1 2 3]
|
||||
@@ -0,0 +1,22 @@
|
||||
PyFile:MissingListSeparators.py
|
||||
PyAssignmentStatement
|
||||
PyTargetExpression: a
|
||||
PsiElement(Py:IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyListLiteralExpression
|
||||
PsiElement(Py:LBRACKET)('[')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('1')
|
||||
PsiErrorElement:expected ',' or ']'
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('2')
|
||||
PsiErrorElement:expected ',' or ']'
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('3')
|
||||
PsiElement(Py:RBRACKET)(']')
|
||||
@@ -214,6 +214,10 @@ public class PythonParsingTest extends ParsingTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMissingListSeparators() { // PY-1933
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void doTest() {
|
||||
doTest(LanguageLevel.PYTHON25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user