Package de.halirutan.mathematica.parsing.psi.impl.assignment

Examples of de.halirutan.mathematica.parsing.psi.impl.assignment.SetDefinitionSymbolVisitor


  public void visitFunctionCall(final FunctionCall functionCall) {
    final String head = functionCall.getHead().getText();
    if (head.matches("Set|SetDelayed")) {
      final PsiElement lhs = functionCall.getArgument(1);
      if (lhs != null) {
        final SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(lhs);
        lhs.accept(visitor);
        cacheAssignedSymbols(visitor.getUnboundSymbols());
      }
    } else if (head.matches("TagSet|TagSetDelayed|SetAttributes|SetOptions")) {
      final PsiElement arg1 = functionCall.getArgument(1);
      if (arg1 instanceof Symbol) {
        myCollectedFunctionNames.add(((Symbol) arg1).getSymbolName());
View Full Code Here


    return myCollectedFunctionNames;
  }

  private void cacheFromSetAssignment(PsiElement element) {
    final PsiElement lhs = element.getFirstChild();
    SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(lhs);
    lhs.accept(visitor);
    cacheAssignedSymbols(visitor.getUnboundSymbols());
  }
View Full Code Here

    @Override
    public void visitFunctionCall(final FunctionCall functionCall) {
      final PsiElement arg1 = functionCall.getArgument(1);
      if (arg1 != null) {
        if (functionCall.matchesHead("Set|SetDelayed")) {
          SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(arg1);
          arg1.accept(visitor);
          final java.util.Set<Symbol> symbols = visitor.getUnboundSymbols();
          for (Symbol symbol : symbols) {
            addAssignment(symbol, arg1,functionCall.matchesHead("Set") ? SET_ASSIGNMENT : SET_DELAYED_ASSIGNMENT);
          }
        } else if (functionCall.matchesHead("TagSet|TagSetDelayed")) {
          if (arg1 instanceof Symbol) {
            addAssignment((Symbol) arg1, functionCall,
                functionCall.matchesHead("TagSet") ? TAG_SET_ASSIGNMENT : TAG_SET_DELAYED_ASSIGNMENT);
          }
        } else if (functionCall.matchesHead("UpSet|UpSetDelayed")) {
          UpSetDefinitionSymbolVisitor visitor = new UpSetDefinitionSymbolVisitor();
          arg1.accept(visitor);
          for (Symbol symbol : visitor.getUnboundSymbols()) {
            addAssignment(symbol, arg1, functionCall.matchesHead("UpSet") ? UP_SET_ASSIGNMENT : UP_SET_DELAYED_ASSIGNMENT);
          }
        } else if (functionCall.matchesHead("SetAttributes")) {
          if (arg1 instanceof Symbol) {
            addAssignment((Symbol) arg1, functionCall, ATTRIBUTES_ASSIGNMENT);
View Full Code Here

    return true;
  }

  private boolean visitSetDefinition(final PsiElement lhs) {
    if (lhs != null) {
      SetDefinitionSymbolVisitor definitionVisitor = new SetDefinitionSymbolVisitor(lhs);
      lhs.accept(definitionVisitor);
      final java.util.Set<Symbol> definitionSymbols = definitionVisitor.getUnboundSymbols();
      for (Symbol next : definitionSymbols) {
        if (next.getSymbolName().equals(myStartElement.getSymbolName())) {
          myReferringSymbol = next;
          return false;
        }
View Full Code Here

  private class CollectorVisitor extends MathematicaRecursiveVisitor {

    @Override
    public void visitSetDelayed(final SetDelayed setDelayed) {
      final PsiElement lhs = setDelayed.getFirstChild();
      SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(lhs, SET_DELAYED_ASSIGNMENT);
      lhs.accept(visitor);
      final java.util.Set<Symbol> unboundSymbols = visitor.getUnboundSymbols();
      for (Symbol symbol : unboundSymbols) {
        addAssignment(symbol, lhs, visitor.getAssignmentType());
      }
    }
View Full Code Here

    }

    @Override
    public void visitSet(final Set set) {
      final PsiElement lhs = set.getFirstChild();
      SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(lhs, SET_ASSIGNMENT);
      lhs.accept(visitor);
      final java.util.Set<Symbol> unboundSymbols = visitor.getUnboundSymbols();
      for (Symbol symbol : unboundSymbols) {
        PsiElement context = lhs;
        if (visitor.getAssignmentType() == ATTRIBUTES_ASSIGNMENT || visitor.getAssignmentType() == OPTIONS_ASSIGNMENT) {
          context = set.getLastChild();
        }
        addAssignment(symbol, context, visitor.getAssignmentType());
      }
    }
View Full Code Here

TOP

Related Classes of de.halirutan.mathematica.parsing.psi.impl.assignment.SetDefinitionSymbolVisitor

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.