improve parser recovery if keyword is used as function or class name (PY-8319)

This commit is contained in:
Dmitry Jemerov
2013-11-05 19:37:49 +01:00
parent 5d6bac5b12
commit 664ee85163
8 changed files with 52 additions and 7 deletions
@@ -0,0 +1,2 @@
class from:
pass
@@ -0,0 +1,13 @@
PyFile:KeywordAsClassName.py
PyClass: null
PsiElement(Py:CLASS_KEYWORD)('class')
PsiWhiteSpace(' ')
PsiErrorElement:Identifier expected
PsiElement(Py:FROM_KEYWORD)('from')
PyArgumentList
<empty list>
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
@@ -0,0 +1,2 @@
def from():
pass
@@ -0,0 +1,14 @@
PyFile:KeywordAsFunctionName.py
PyFunction('null')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiErrorElement:function name expected
PsiElement(Py:FROM_KEYWORD)('from')
PyParameterList
PsiElement(Py:LPAR)('(')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')