From 942eff8eb0d0aa72da8820ae3a434997b878f809 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Sun, 3 Feb 2008 16:28:37 +0300 Subject: [PATCH] support for Python 2.5 yield expressions --- .../returnWithArgumentsInGenerator.py | 3 ++ .../highlighting/yieldOutsideOfFunction.py | 1 + python/testData/psi/YieldAsArgument.py | 2 ++ python/testData/psi/YieldAsArgument.txt | 0 python/testData/psi/YieldInAssignment.py | 2 ++ python/testData/psi/YieldInAssignment.txt | 22 +++++++++++++ python/testData/psi/YieldInAugAssignment.py | 3 ++ python/testData/psi/YieldInAugAssignment.txt | 31 +++++++++++++++++++ python/testData/psi/YieldInParentheses.py | 2 ++ python/testData/psi/YieldInParentheses.txt | 28 +++++++++++++++++ python/testData/psi/YieldStatement.py | 2 ++ python/testData/psi/YieldStatement.txt | 17 ++++++++++ 12 files changed, 113 insertions(+) create mode 100644 python/testData/highlighting/returnWithArgumentsInGenerator.py create mode 100644 python/testData/highlighting/yieldOutsideOfFunction.py create mode 100644 python/testData/psi/YieldAsArgument.py create mode 100644 python/testData/psi/YieldAsArgument.txt create mode 100644 python/testData/psi/YieldInAssignment.py create mode 100644 python/testData/psi/YieldInAssignment.txt create mode 100644 python/testData/psi/YieldInAugAssignment.py create mode 100644 python/testData/psi/YieldInAugAssignment.txt create mode 100644 python/testData/psi/YieldInParentheses.py create mode 100644 python/testData/psi/YieldInParentheses.txt create mode 100644 python/testData/psi/YieldStatement.py create mode 100644 python/testData/psi/YieldStatement.txt diff --git a/python/testData/highlighting/returnWithArgumentsInGenerator.py b/python/testData/highlighting/returnWithArgumentsInGenerator.py new file mode 100644 index 000000000000..2f3e1d88ace0 --- /dev/null +++ b/python/testData/highlighting/returnWithArgumentsInGenerator.py @@ -0,0 +1,3 @@ +def f(): + yield 42 + return 28 \ No newline at end of file diff --git a/python/testData/highlighting/yieldOutsideOfFunction.py b/python/testData/highlighting/yieldOutsideOfFunction.py new file mode 100644 index 000000000000..25829f35c6d0 --- /dev/null +++ b/python/testData/highlighting/yieldOutsideOfFunction.py @@ -0,0 +1 @@ +yield 42 \ No newline at end of file diff --git a/python/testData/psi/YieldAsArgument.py b/python/testData/psi/YieldAsArgument.py new file mode 100644 index 000000000000..450791aec7d2 --- /dev/null +++ b/python/testData/psi/YieldAsArgument.py @@ -0,0 +1,2 @@ +def f(): + foo(yield 42) \ No newline at end of file diff --git a/python/testData/psi/YieldAsArgument.txt b/python/testData/psi/YieldAsArgument.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/testData/psi/YieldInAssignment.py b/python/testData/psi/YieldInAssignment.py new file mode 100644 index 000000000000..cca45e032e02 --- /dev/null +++ b/python/testData/psi/YieldInAssignment.py @@ -0,0 +1,2 @@ +def f(): + x = yield 42 diff --git a/python/testData/psi/YieldInAssignment.txt b/python/testData/psi/YieldInAssignment.txt new file mode 100644 index 000000000000..d62e57d8642e --- /dev/null +++ b/python/testData/psi/YieldInAssignment.txt @@ -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') \ No newline at end of file diff --git a/python/testData/psi/YieldInAugAssignment.py b/python/testData/psi/YieldInAugAssignment.py new file mode 100644 index 000000000000..efda3dae6090 --- /dev/null +++ b/python/testData/psi/YieldInAugAssignment.py @@ -0,0 +1,3 @@ +def g(): + x = 0 + x += yield 42 \ No newline at end of file diff --git a/python/testData/psi/YieldInAugAssignment.txt b/python/testData/psi/YieldInAugAssignment.txt new file mode 100644 index 000000000000..0e9675f13b4c --- /dev/null +++ b/python/testData/psi/YieldInAugAssignment.txt @@ -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') \ No newline at end of file diff --git a/python/testData/psi/YieldInParentheses.py b/python/testData/psi/YieldInParentheses.py new file mode 100644 index 000000000000..a58949e7c1b2 --- /dev/null +++ b/python/testData/psi/YieldInParentheses.py @@ -0,0 +1,2 @@ +def f(): + x = 12 + (yield) \ No newline at end of file diff --git a/python/testData/psi/YieldInParentheses.txt b/python/testData/psi/YieldInParentheses.txt new file mode 100644 index 000000000000..d023400e6c37 --- /dev/null +++ b/python/testData/psi/YieldInParentheses.txt @@ -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)(')') \ No newline at end of file diff --git a/python/testData/psi/YieldStatement.py b/python/testData/psi/YieldStatement.py new file mode 100644 index 000000000000..c793fe617796 --- /dev/null +++ b/python/testData/psi/YieldStatement.py @@ -0,0 +1,2 @@ +def f(): + yield 42 \ No newline at end of file diff --git a/python/testData/psi/YieldStatement.txt b/python/testData/psi/YieldStatement.txt new file mode 100644 index 000000000000..a5c3897eced1 --- /dev/null +++ b/python/testData/psi/YieldStatement.txt @@ -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') \ No newline at end of file