mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Better error recovery for lines with single 'class' or 'def' keywords and normal functions defined below
This commit is contained in:
@@ -2,7 +2,7 @@ PyFile:KeywordAsFunctionName.py
|
||||
PyFunction('null')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:function name expected
|
||||
PsiErrorElement:Identifier expected
|
||||
PsiElement(Py:FROM_KEYWORD)('from')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class
|
||||
|
||||
|
||||
def foo():
|
||||
pass
|
||||
@@ -0,0 +1,25 @@
|
||||
PyFile:SingleClassBeforeFunction.py
|
||||
PyClass: null
|
||||
PsiElement(Py:CLASS_KEYWORD)('class')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PyArgumentList
|
||||
<empty list>
|
||||
PsiErrorElement:Colon expected
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n\n\n')
|
||||
PyStatementList
|
||||
PsiErrorElement:Indent expected
|
||||
<empty list>
|
||||
PyFunction('foo')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('foo')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyPassStatement
|
||||
PsiElement(Py:PASS_KEYWORD)('pass')
|
||||
@@ -0,0 +1,5 @@
|
||||
def
|
||||
|
||||
|
||||
def bar():
|
||||
x = 1
|
||||
@@ -0,0 +1,31 @@
|
||||
PyFile:SingleDefBeforeFunction.py
|
||||
PyFunction('null')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
PyParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n\n\n')
|
||||
PyStatementList
|
||||
PsiErrorElement:Indent expected
|
||||
<empty list>
|
||||
PyFunction('bar')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('bar')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyAssignmentStatement
|
||||
PyTargetExpression: x
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('1')
|
||||
Reference in New Issue
Block a user