public String getCVarsWithLines(PosSymbol pos, String prepend) {
   String[] typeString = getVarType(pos.getName());
   if (prepend != null) {
     typeString[0] = prepend + typeString[0];
   }
   int n = pos.getLocation().getPos().getLine() - lineCount;
   return stringWithLines(typeString[0], n);
 }
 public String stringFromSym(PosSymbol pos, String prepend) {
   int n = pos.getLocation().getPos().getLine() - lineCount;
   String retString;
   if (prepend != null) {
     retString = prepend + pos.getName();
   } else {
     retString = pos.getName();
   }
   return stringWithLines(retString, n);
 }
示例#3
0
 public NameQuery(
     PosSymbol qualifier,
     PosSymbol name,
     ImportStrategy importStrategy,
     FacilityStrategy facilityStrategy,
     boolean localPriority) {
   this(qualifier, name.getName(), importStrategy, facilityStrategy, localPriority);
 }
  /** Returns a formatted text string of this class. */
  public String asString(int indent, int increment) {

    StringBuffer sb = new StringBuffer();

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

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

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

    return sb.toString();
  }
  /**
   * Creates a new function and adds to funcList. Sets it to currentFunc.
   *
   * @param newFuncName name of function
   * @param newReturnTy type of return value from function
   */
  public void addFunction(PosSymbol newFuncName, PosSymbol newReturnTy) {
    Function newFunc = new Function();

    newFunc.returnType = new String[2];
    newFunc.returnType[0] = "void ";
    if (newReturnTy != null) {
      newFunc.returnType = getVarType(newReturnTy.getName());
    }
    newFunc.returnName = newFuncName.getName();
    String temp = "public static " + newFunc.returnType[0];
    newFunc.functionName = stringFromSym(newFuncName, temp);
    String te = newFunc.functionName.trim();
    funcList.add(newFunc);
    newFunc.params = new ArrayList<String>();
    newFunc.stmts = new ArrayList<String>();
    newFunc.varInit = new ArrayList<String>();
    newFunc.allStmt = new StringBuffer();
    currentFunc = newFunc;
  }
示例#6
0
  /** Returns a formatted text string of this class. */
  public String toString(int indent) {

    StringBuffer sb = new StringBuffer();
    printSpace(indent, sb);

    if (semanticExp != null) {
      sb.append(semanticExp.toString(0));
    } else {
      printSpace(indent, sb);

      if (name != null) {
        sb.append(name.getName().toString());
      }

      if (arguments != null) {
        sb.append("(" + argumentsToString(arguments) + ")");
      }
    }

    return sb.toString();
  }
示例#7
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("ProgramParamExp\n");

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

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

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

    return sb.toString();
  }
示例#8
0
 public String toString() {
   return name.getName();
 }
 public OperationSearcher(PosSymbol name, List<PTType> argumentTypes) {
   myQueryName = name.getName();
   myQueryLocation = name.getLocation();
   myActualArgumentTypes = new LinkedList<PTType>(argumentTypes);
 }