void (PyElementType ifKeyword, PyElementType elifKeyword, PyElementType elseKeyword, PyElementType elementType) { assertCurrentToken(ifKeyword); final SyntaxTreeBuilder.Marker ifStatement = myBuilder.mark(); final SyntaxTreeBuilder.Marker ifPart = myBuilder.mark(); myBuilder.advanceLexer(); if (!getExpressionParser().parseNamedTestExpression(false, false)) { myBuilder.error(PyParsingBundle.message("PARSE.expected.expression")); } parseColonAndSuite(); ifPart.done(PyElementTypes.IF_PART_IF); SyntaxTreeBuilder.Marker elifPart = myBuilder.mark(); while (myBuilder.getTokenType() == elifKeyword) { myBuilder.advanceLexer(); if (!getExpressionParser().parseNamedTestExpression(false, false)) { myBuilder.error(PyParsingBundle.message("PARSE.expected.expression")); } parseColonAndSuite(); elifPart.done(PyElementTypes.IF_PART_ELIF); elifPart = myBuilder.mark(); } elifPart.drop(); // we always kept an open extra elif final SyntaxTreeBuilder.Marker elsePart = myBuilder.mark(); if (myBuilder.getTokenType() == elseKeyword) { myBuilder.advanceLexer(); parseColonAndSuite(); elsePart.done(PyElementTypes.ELSE_PART); } else { elsePart.drop(); } ifStatement.done(elementType); }