private static void consumeBadTokens(PsiBuilder builder, TokenSet nextAccepted) {
    if (nextAccepted.getTypes().length == 0 && builder.eof()) {
      return;
    }
    if (!nextAccepted.contains(builder.getTokenType())) {
      builder.error(XPathBundle.message("parsing.error.unexpected.token"));
      do {
        if (builder.eof()) {
          builder.error(XPathBundle.message("parsing.error.unexpected.end.file"));
          break;
        }
        builder.advanceLexer();
      } while (!nextAccepted.contains(builder.getTokenType()));
    }
  }
private static void consumeBadTokens(PsiBuilder builder, TokenSet nextAccepted)