mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 13:39:36 +07:00
The cause of the problem was the difference in parsing for different language levels. This commit improves error recovery and adds support for stubs for syntax elements unavailable in older Python versions. Cases that are covered are necessary for stubs generation for Python 3.6 standard library. They are discovered by automatic validation executed by stubs generator in StubsGenerator.kt. Those are the cases that were fixed: * A stub for single star argument in Py2 was absent * Type annotations in Py2 were absent * Print with end argument in Py2 broke parser * Exec function as argument in Py2 broke parser * Async keyword after decorator broke parser All the cases are listed as test cases in PyUnifiedStubsTest P.S. It is possible though that more cases will be revealed in future.
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
PyFile:AsyncWith.py
|
|
PyFunction('foo')
|
|
PsiElement(Py:ASYNC_KEYWORD)('async')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:DEF_KEYWORD)('def')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:IDENTIFIER)('foo')
|
|
PyParameterList
|
|
PsiElement(Py:LPAR)('(')
|
|
PsiElement(Py:RPAR)(')')
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace('\n ')
|
|
PyStatementList
|
|
PyWithStatement
|
|
PsiElement(Py:ASYNC_KEYWORD)('async')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:WITH_KEYWORD)('with')
|
|
PsiWhiteSpace(' ')
|
|
PyWithItem
|
|
PyReferenceExpression: x
|
|
PsiElement(Py:IDENTIFIER)('x')
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace('\n ')
|
|
PyStatementList
|
|
PyPassStatement
|
|
PsiElement(Py:PASS_KEYWORD)('pass')
|
|
PsiWhiteSpace('\n\n')
|
|
PyWithStatement
|
|
PsiErrorElement:'async' keyword is not expected here
|
|
PsiElement(Py:IDENTIFIER)('async')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:WITH_KEYWORD)('with')
|
|
PsiWhiteSpace(' ')
|
|
PyWithItem
|
|
PyReferenceExpression: y
|
|
PsiElement(Py:IDENTIFIER)('y')
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace('\n ')
|
|
PyStatementList
|
|
PyPassStatement
|
|
PsiElement(Py:PASS_KEYWORD)('pass') |