Package org.jetbrains.plugins.clojure.psi

Examples of org.jetbrains.plugins.clojure.psi.ClojurePsiElement


      } else {
        result.add(new TextRange(left.getTextRange().getStartOffset(), element.getTextRange().getEndOffset()));
      }
    }
    if (element instanceof ClojurePsiElement) {
      final ClojurePsiElement psi = (ClojurePsiElement) element;
      final PsiElement fst = psi.getFirstNonLeafElement();
      final PsiElement lst = psi.getLastNonLeafElement();
      final int start = fst != null ? fst.getTextRange().getStartOffset() : psi.getTextRange().getStartOffset();
      final int end = lst != null ? lst.getTextRange().getEndOffset() : psi.getTextRange().getEndOffset();
      result.add(new TextRange(start, end));
    }


    return result;
View Full Code Here


  @Nullable
  public ClSymbol getNameSymbol() {
    final PsiElement element = getSecondNonLeafElement();
    if (element instanceof ClQuotedForm) {
      final ClQuotedForm form = (ClQuotedForm) element;
      final ClojurePsiElement elt = form.getQuotedElement();
      if (elt instanceof ClSymbol) {
        return (ClSymbol) elt;
      }
      return null;
    }
View Full Code Here

  private static boolean processRequireInner(PsiScopeProcessor processor, PsiElement place, ClListLike child, boolean requireKeyword, boolean requireFunction) {
    for (PsiElement stmt : child.getChildren()) {
      if (requireKeyword && !checkRequireStatement(processor, place, child, stmt)) return true;
      if (requireFunction && stmt instanceof ClQuotedForm) {
        final ClojurePsiElement quotedElement = ((ClQuotedForm) stmt).getQuotedElement();
        if (!checkRequireStatement(processor, place, child, quotedElement)) return true;
      }
    }
    return false;
  }
View Full Code Here

  private static boolean processReferInner(PsiScopeProcessor processor, PsiElement place, ClListLike child, boolean referKeyword, boolean referFunction) {
    for (PsiElement stmt : child.getChildren()) {
      if (referKeyword && !checkReferStatement(processor, place, child, stmt)) return true;
      if (referFunction && stmt instanceof ClQuotedForm) {
        final ClojurePsiElement quotedElement = ((ClQuotedForm) stmt).getQuotedElement();
        if (!checkReferStatement(processor, place, child, quotedElement)) return true;
      }
    }
    return false;
  }
View Full Code Here

    final boolean isImportFunction = ListDeclarations.IMPORT.equals(headText);
    if (isImportKeyword || isImportFunction) {
      for (PsiElement stmt : child.getChildren()) {
        if (!checkImportStatement(processor, place, child, stmt)) return false;
        if (isImportFunction && stmt instanceof ClQuotedForm) {
          final ClojurePsiElement quotedElement = ((ClQuotedForm) stmt).getQuotedElement();
          if (!checkImportStatement(processor, place, child, quotedElement)) return false;
        }
      }
    }
View Full Code Here

          }
        } else if (isRename) {
          final PsiElement map = ClojurePsiUtil.getNextNonWhiteSpace(child);
          if (map instanceof ClMap) {
            for (ClMapEntry entry : ((ClMap) map).getEntries()) {
              final ClojurePsiElement key = entry.getKey();
              final ClojurePsiElement value = entry.getValue();
              if (key instanceof ClSymbol && value instanceof ClSymbol) {
                result.addRename(((ClSymbol) key).getNameString(), (ClSymbol) value);
              }
            }
          }
View Full Code Here

  public ClSymbol[] getOddSymbols() {
    final ClojurePsiElement[] elems = findChildrenByClass(ClojurePsiElement.class);
    final ArrayList<ClSymbol> res = new ArrayList<ClSymbol>();
    for (int i = 0; i < elems.length; i++) {
      ClojurePsiElement elem = elems[i];
      if (i % 2 == 0 && elem instanceof ClSymbol) {
        res.add((ClSymbol) elem);
      }
    }
    return res.toArray(new ClSymbol[res.size()]);
View Full Code Here

    return null;
  }

  private String processMetadata(@NotNull ClMetadata meta) {
    final StringBuffer buffer = new StringBuffer();
    final ClojurePsiElement args = meta.getValue("arglists");
    if (args != null) {
      if (args instanceof ClQuotedForm) {
        ClQuotedForm form = (ClQuotedForm) args;
        if (form.getQuotedElement() instanceof ClList) {
          ClList list = (ClList) form.getQuotedElement();
          final ArrayList<String> chunks = new ArrayList<String>();
          if (list != null) {
            for (PsiElement element : list.getChildren()) {
              if (element instanceof ClVector) {
                chunks.add(element.getText());
              }
            }
          }
          buffer.append("Arguments:\n");
          for (String chunk : chunks) {
            buffer.append("<b>").append(chunk.trim()).append("</b>").append("\n");
          }
          buffer.append("<br/>");
        }
      }
    }

    final ClojurePsiElement value = meta.getValue("doc");
    if (value != null) {
      buffer.append(processString(value));
    }
    return buffer.toString();
  }
View Full Code Here

TOP

Related Classes of org.jetbrains.plugins.clojure.psi.ClojurePsiElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.