void () { SyntaxTreeBuilder.Marker mark = myBuilder.mark(); int initialBalance = myPendingClosingBraces.size(); boolean consumedAny = false; while (!myBuilder.eof() && !atAnyOfTokens(PyTokenTypes.IF_KEYWORD, PyTokenTypes.COLON, PyTokenTypes.AS_KEYWORD, PyTokenTypes.OR, PyTokenTypes.STATEMENT_BREAK)) { IElementType token = myBuilder.getTokenType(); if (myPendingClosingBraces.size() == initialBalance && (myPendingClosingBraces.contains(token) || token == PyTokenTypes.COMMA)) { break; } nextToken(); consumedAny = true; if (PyTokenTypes.ALL_BRACES.contains(token)) { registerConsumedBracket(token); } } if (consumedAny) { mark.error(PyParsingBundle.message("unexpected.tokens")); } else { mark.drop(); } }