support raise ... from in Python 3

This commit is contained in:
Dmitry Jemerov
2010-01-25 17:16:13 +03:00
parent 3ff98b5c94
commit 8f165490c1
4 changed files with 20 additions and 0 deletions
@@ -303,6 +303,10 @@ public class StatementParsing extends Parsing implements ITokenTypeRemapper {
getExpressionParser().parseSingleExpression(false);
}
}
else if (myBuilder.getTokenType() == PyTokenTypes.FROM_KEYWORD) {
myBuilder.advanceLexer();
getExpressionParser().parseSingleExpression(false);
}
}
checkEndOfStatement(inSuite);
raiseStatement.done(PyElementTypes.RAISE_STATEMENT);
+1
View File
@@ -0,0 +1 @@
raise SyntaxError from exc
+11
View File
@@ -0,0 +1,11 @@
PyFile:RaiseFrom.py
PyRaiseStatement
PsiElement(Py:RAISE_KEYWORD)('raise')
PsiWhiteSpace(' ')
PyReferenceExpression: SyntaxError
PsiElement(Py:IDENTIFIER)('SyntaxError')
PsiWhiteSpace(' ')
PsiElement(Py:FROM_KEYWORD)('from')
PsiWhiteSpace(' ')
PyReferenceExpression: exc
PsiElement(Py:IDENTIFIER)('exc')
@@ -154,6 +154,10 @@ public class PythonParsingTest extends ParsingTestCase {
doTest(LanguageLevel.PYTHON30);
}
public void testRaiseFrom() throws Exception {
doTest(LanguageLevel.PYTHON30);
}
public void doTest() throws Exception {
doTest(LanguageLevel.PYTHON25);
}