mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
support for Python 2.5 yield expressions
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
def f():
|
||||
yield 42
|
||||
<error descr="'return' with argument inside generator">return 28</error>
|
||||
@@ -0,0 +1 @@
|
||||
<error descr="'yield' outside of function">yield 42</error>
|
||||
@@ -0,0 +1,2 @@
|
||||
def f():
|
||||
foo(yield 42)
|
||||
@@ -0,0 +1,2 @@
|
||||
def f():
|
||||
x = yield 42
|
||||
@@ -0,0 +1,22 @@
|
||||
PyFile:YieldInAssignment.py
|
||||
PyFunction
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('f')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyAssignmentStatement
|
||||
PyReferenceExpression: x
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyYieldExpression
|
||||
PsiElement(Py:YIELD_KEYWORD)('yield')
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('42')
|
||||
@@ -0,0 +1,3 @@
|
||||
def g():
|
||||
x = 0
|
||||
x += yield 42
|
||||
@@ -0,0 +1,31 @@
|
||||
PyFile:YieldInAugAssignment.py
|
||||
PyFunction
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('g')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyAssignmentStatement
|
||||
PyReferenceExpression: x
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('0')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyAugAssignmentStatement
|
||||
PyReferenceExpression: x
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:PLUSEQ)('+=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyYieldExpression
|
||||
PsiElement(Py:YIELD_KEYWORD)('yield')
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('42')
|
||||
@@ -0,0 +1,2 @@
|
||||
def f():
|
||||
x = 12 + (yield)
|
||||
@@ -0,0 +1,28 @@
|
||||
PyFile:YieldInParentheses.py
|
||||
PyFunction
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('f')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyAssignmentStatement
|
||||
PyReferenceExpression: x
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyBinaryExpression
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('12')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:PLUS)('+')
|
||||
PsiWhiteSpace(' ')
|
||||
PyParenthesizedExpression
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyYieldExpression
|
||||
PsiElement(Py:YIELD_KEYWORD)('yield')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
@@ -0,0 +1,2 @@
|
||||
def f():
|
||||
yield 42
|
||||
@@ -0,0 +1,17 @@
|
||||
PyFile:YieldStatement.py
|
||||
PyFunction
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('f')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyExpressionStatement
|
||||
PyYieldExpression
|
||||
PsiElement(Py:YIELD_KEYWORD)('yield')
|
||||
PsiWhiteSpace(' ')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('42')
|
||||
Reference in New Issue
Block a user