mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
tweak lambda parsing: don't put colon inside parameter list (for consistency with regular functions)
This commit is contained in:
@@ -173,11 +173,15 @@ public class FunctionParsing extends Parsing {
|
||||
}
|
||||
}
|
||||
|
||||
if (myBuilder.getTokenType() == endToken) {
|
||||
if (myBuilder.getTokenType() == endToken && endToken == PyTokenTypes.RPAR) {
|
||||
myBuilder.advanceLexer();
|
||||
}
|
||||
|
||||
parameterList.done(PyElementTypes.PARAMETER_LIST);
|
||||
|
||||
if (myBuilder.getTokenType() == endToken && endToken == PyTokenTypes.COLON) {
|
||||
myBuilder.advanceLexer();
|
||||
}
|
||||
}
|
||||
|
||||
private void parseParameterSubList() {
|
||||
|
||||
@@ -25,7 +25,7 @@ PyFile:ConditionalParenLambda.py
|
||||
PyParameterList
|
||||
PyNamedParameter('x')
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PyConditionalExpression
|
||||
PyReferenceExpression: x
|
||||
|
||||
@@ -16,7 +16,8 @@ PyFile:LambdaComprehension.py
|
||||
PyLambdaExpression
|
||||
PsiElement(Py:LAMBDA_KEYWORD)('lambda')
|
||||
PyParameterList
|
||||
PsiElement(Py:COLON)(':')
|
||||
<empty list>
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PyReferenceExpression: True
|
||||
PsiElement(Py:IDENTIFIER)('True')
|
||||
@@ -25,7 +26,8 @@ PyFile:LambdaComprehension.py
|
||||
PyLambdaExpression
|
||||
PsiElement(Py:LAMBDA_KEYWORD)('lambda')
|
||||
PyParameterList
|
||||
PsiElement(Py:COLON)(':')
|
||||
<empty list>
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PyReferenceExpression: False
|
||||
PsiElement(Py:IDENTIFIER)('False')
|
||||
|
||||
@@ -6,7 +6,7 @@ PyFile:LambdaConditional.py
|
||||
PyParameterList
|
||||
PyNamedParameter('x')
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PyConditionalExpression
|
||||
PyNumericLiteralExpression
|
||||
|
||||
Reference in New Issue
Block a user