Package de.halirutan.mathematica.parsing.psi.api

Examples of de.halirutan.mathematica.parsing.psi.api.Symbol


   */
  public List<Symbol> getSymbols() {

    Collections.sort(mySymbols, new SymbolComparator());
    Pattern pattern = Pattern.compile(myStartElement.getSymbolName().substring(0, 1) + ".*");
    Symbol tmp = null;
    for (Iterator<Symbol> symbolIterator = mySymbols.iterator(); symbolIterator.hasNext(); ) {
      Symbol next = symbolIterator.next();

      if (!pattern.matcher(next.getSymbolName()).matches()) {
        symbolIterator.remove();
        continue;
      }

      if (tmp == null) {
        tmp = next;
        continue;
      }

      if (tmp.getSymbolName().equals(next.getSymbolName())) {
        symbolIterator.remove();
      } else {
        tmp = next;
      }

View Full Code Here


    contributor.extend(CompletionType.BASIC, symbolPattern, this);
  }

  @Override
  protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    final Symbol callingSymbol = (Symbol) parameters.getPosition().getParent();
    final String callingSymbolName = callingSymbol.getSymbolName();

    if (!parameters.isExtendedCompletion()) {
      final PsiFile containingFile = parameters.getOriginalFile();
      List<Symbol> variants = Lists.newArrayList();
View Full Code Here

  public static final int MAX_UPWARD_STEPS = 3;

  @Override
  public boolean isAccepted(PsiElement element) {
    if (element instanceof Symbol) {
      Symbol symbol = (Symbol) element;
      PsiElement parent = symbol.getParent();
      int iter = 0;
      while (parent != null && ++iter != MAX_UPWARD_STEPS && !(parent instanceof PsiFile)) {
        if (parent instanceof Set || parent instanceof SetDelayed) {
          final List<Symbol> assignmentSymbols = MathematicaPsiUtilities.getAssignmentSymbols(parent);
          return assignmentSymbols != null && assignmentSymbols.contains(element);
View Full Code Here

    // containing the lookup name back.
    final LookupEx activeLookup = LookupManager.getActiveLookup(editor);
    if ((activeLookup != null) && activeLookup.isFocused()) {
      final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset() - 1);
      if (elementAt != null) {
        Symbol lookup = new SymbolImpl(elementAt.getNode());
        final LookupElement currentItem = activeLookup.getCurrentItem();
        final String lookupString = currentItem != null ? currentItem.getLookupString() : "";
        lookup.setName(lookupString);
        return lookup;
      }
    }

    if (contextElement != null) {
View Full Code Here

TOP

Related Classes of de.halirutan.mathematica.parsing.psi.api.Symbol

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.