void (@NotNull @ParsingError String errorMessage, IElementType @NotNull ... types) { final SyntaxTreeBuilder.Marker errorMarker = myBuilder.mark(); boolean hasNonWhitespaceTokens = false; while (!(atAnyOfTokens(types) || myBuilder.eof())) { // Regular whitespace tokens are already skipped by advancedLexer() if (!atToken(PyTokenTypes.STATEMENT_BREAK)) { hasNonWhitespaceTokens = true; } myBuilder.advanceLexer(); } if (hasNonWhitespaceTokens) { errorMarker.error(errorMessage); } else { errorMarker.drop(); } }