@Override
  @NotNull
  public ASTNode parse(@NotNull IElementType root, @NotNull PsiBuilder builder) {
    builder.setDebugMode(DBG_MODE);

    final PsiBuilder.Marker rootMarker = builder.mark();
    if (!builder.eof()) {
      boolean avt = false;
      if (builder.getTokenType() == XPathTokenTypes.LBRACE) {
        builder.advanceLexer();
        avt = true;
      }
      if (!parseExpr(builder)) {
        builder.error(XPathBundle.message("parsing.error.xpath.expression.expected"));
      }
      if (avt) {
        checkMatches(builder, XPathTokenTypes.RBRACE, XPathBundle.message("parsing.error.closing.brace.expected"));
      }
      consumeBadTokens(builder, TokenSet.EMPTY);
    }
    rootMarker.done(root);
    return builder.getTreeBuilt();
  }
@Override
  @NotNull
  public ASTNode parse(@NotNull IElementType root, @NotNull PsiBuilder builder)