From 10a22ea110aadcf552ed56b4048f482690570446 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 26 Jan 2010 16:24:15 +0300 Subject: [PATCH] add //= to augmented assignment operators --- python/src/com/jetbrains/python/PyTokenTypes.java | 2 +- .../src/com/jetbrains/python/psi/PyFileElementType.java | 2 +- python/testData/psi/FloorDiv.py | 1 + python/testData/psi/FloorDiv.txt | 9 +++++++++ .../testSrc/com/jetbrains/python/PythonParsingTest.java | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 python/testData/psi/FloorDiv.py create mode 100644 python/testData/psi/FloorDiv.txt diff --git a/python/src/com/jetbrains/python/PyTokenTypes.java b/python/src/com/jetbrains/python/PyTokenTypes.java index aeec2cada9ed..c25d33085146 100644 --- a/python/src/com/jetbrains/python/PyTokenTypes.java +++ b/python/src/com/jetbrains/python/PyTokenTypes.java @@ -144,7 +144,7 @@ public class PyTokenTypes { public static final TokenSet CLOSE_BRACES = TokenSet.create(RBRACKET, RBRACE, RPAR); public static final TokenSet AUG_ASSIGN_OPERATIONS = TokenSet.create(PLUSEQ, MINUSEQ, MULTEQ, DIVEQ, - PERCEQ, EXPEQ, GTGTEQ, LTLTEQ, ANDEQ, OREQ, XOREQ); + PERCEQ, EXPEQ, GTGTEQ, LTLTEQ, ANDEQ, OREQ, XOREQ, FLOORDIVEQ); public static final PyElementType BACKSLASH = new PyElementType("BACKSLASH"); diff --git a/python/src/com/jetbrains/python/psi/PyFileElementType.java b/python/src/com/jetbrains/python/psi/PyFileElementType.java index 246fd69e50e9..859e350d4842 100644 --- a/python/src/com/jetbrains/python/psi/PyFileElementType.java +++ b/python/src/com/jetbrains/python/psi/PyFileElementType.java @@ -24,7 +24,7 @@ public class PyFileElementType extends IStubFileElementType { @Override public int getStubVersion() { - return 9; + return 10; } @Override diff --git a/python/testData/psi/FloorDiv.py b/python/testData/psi/FloorDiv.py new file mode 100644 index 000000000000..1204c35840b7 --- /dev/null +++ b/python/testData/psi/FloorDiv.py @@ -0,0 +1 @@ +a //= 2 diff --git a/python/testData/psi/FloorDiv.txt b/python/testData/psi/FloorDiv.txt new file mode 100644 index 000000000000..9b505fbfe7bf --- /dev/null +++ b/python/testData/psi/FloorDiv.txt @@ -0,0 +1,9 @@ +PyFile:FloorDiv.py + PyAugAssignmentStatement + PyReferenceExpression: a + PsiElement(Py:IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(Py:FLOORDIVEQ)('//=') + PsiWhiteSpace(' ') + PyNumericLiteralExpression + PsiElement(Py:INTEGER_LITERAL)('2') \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PythonParsingTest.java b/python/testSrc/com/jetbrains/python/PythonParsingTest.java index 899b79218607..d8bff032ffaf 100644 --- a/python/testSrc/com/jetbrains/python/PythonParsingTest.java +++ b/python/testSrc/com/jetbrains/python/PythonParsingTest.java @@ -182,6 +182,10 @@ public class PythonParsingTest extends ParsingTestCase { doTest(LanguageLevel.PYTHON30); } + public void testFloorDiv() throws Exception { + doTest(); + } + public void testWithStatement31() throws Exception { doTest(LanguageLevel.PYTHON31); }