mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
support raise ... from in Python 3
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
raise SyntaxError from exc
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user