tweak Python parser to handle incomplete code better (PY-4053)

This commit is contained in:
Dmitry Jemerov
2011-07-01 16:16:53 +02:00
parent 4bec759ac9
commit 17178af318
6 changed files with 58 additions and 6 deletions
@@ -0,0 +1,5 @@
def get_key():
if isinstance(self.instance,
def clean():
pass
@@ -0,0 +1,41 @@
PyFile:MissingParenInCall.py
PyFunction('get_key')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('get_key')
PyParameterList
PsiElement(Py:LPAR)('(')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyIfStatement
PyIfPartIf
PsiElement(Py:IF_KEYWORD)('if')
PsiWhiteSpace(' ')
PyCallExpression: isinstance
PyReferenceExpression: isinstance
PsiElement(Py:IDENTIFIER)('isinstance')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyReferenceExpression: instance
PyReferenceExpression: self
PsiElement(Py:IDENTIFIER)('self')
PsiElement(Py:DOT)('.')
PsiElement(Py:IDENTIFIER)('instance')
PsiElement(Py:COMMA)(',')
PsiErrorElement:expression expected
<empty list>
PsiWhiteSpace('\n\n')
PyFunction('clean')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('clean')
PyParameterList
PsiElement(Py:LPAR)('(')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')