示例#1
0
 String argumentsToString(List<VariableExp> arguments) {
   String str = new String();
   Iterator<VariableExp> i = arguments.iterator();
   while (i.hasNext()) {
     VariableExp exp = (VariableExp) i.next();
     str = str.concat(exp.toString(0));
     if (i.hasNext()) str = str.concat(", ");
   }
   return str;
 }
示例#2
0
 /** Returns true if the variable is found in any sub expression of this one. * */
 public boolean containsVar(String varName, boolean IsOldExp) {
   Iterator<VariableExp> i = segments.iterator();
   while (i.hasNext()) {
     VariableExp temp = i.next();
     if (temp != null) {
       if (temp.containsVar(varName, IsOldExp)) {
         return true;
       }
     }
   }
   if (semanticExp != null) {
     if (semanticExp.containsVar(varName, IsOldExp)) {
       return true;
     }
   }
   return false;
 }
示例#3
0
  private boolean differentTypeCompare1(ProgramParamExp programParamExp, VariableExp variableExp) {
    String paramExp = programParamExp.getName().toString();
    String varName = variableExp.toString();

    if (paramExp.equals(varName)) {
      return true;
    }
    // System.out.println("not equal");
    return false;
  }
示例#4
0
  private boolean variableCompare(VariableExp variableExp, VariableExp variableExp2) {
    List<Exp> subExp1 = variableExp.getSubExpressions();
    List<Exp> subExp2 = variableExp2.getSubExpressions();
    String varName1 = variableExp2.toString();
    String varName2 = variableExp.toString();

    if (variableExp instanceof VariableNameExp) {
      // System.out.println(((VariableNameExp)variableExp).getName().toString());
    }
    // System.out.println(subExp1.toString());
    // System.out.println(subExp2.toString());

    // System.out.println(varName1);
    // System.out.println(varName2);
    // System.out.println(variableExp.toString());

    if (varName1.equals(varName2)) {
      // System.out.println("they are equal");
      return true;
    }

    return false;
  }
示例#5
0
  public String toString(int indent) {

    StringBuffer sb = new StringBuffer();

    printSpace(indent, sb);

    printSpace(indent, sb);

    sb.append(segmentsToString(this.segments));

    if (semanticExp != null) {
      sb.append(semanticExp.toString(0));
    }

    return sb.toString();
  }
示例#6
0
  /** Returns a formatted text string of this class. */
  public String asString(int indent, int increment) {

    StringBuffer sb = new StringBuffer();

    printSpace(indent, sb);
    sb.append("VariableDotExp\n");

    if (segments != null) {
      sb.append(segments.asString(indent + increment, increment));
    }

    if (semanticExp != null) {
      sb.append(semanticExp.asString(indent + increment, increment));
    }

    return sb.toString();
  }