public String getReferenceName(boolean quoted) {
    String text = getNode().getText();
    if ("__".equals(text))
      return text;

    text = text.replaceAll("\\\\([^\\\\]+)", "$1");
    if (text.startsWith("_`") && !quoted)
      return text.substring(2, text.length()-2);

    if (text.startsWith("_"))
      return text.substring(1, text.length()-1);

    if (text.startsWith("[#") && !quoted && text.length()>3)
      return text.substring(2, text.length()-1);

    if (text.startsWith("[") && !quoted)
      return text.substring(1, text.length()-1);

    return text;
  }
public String getReferenceName(boolean quoted)