Esempio n. 1
0
  /**
   * @param line - linha com a definicao
   * @param level - nivel do symbolo
   */
  public SymbolArray(String line, Memory mem, int level) throws LanguageException {
    super(Symbol.ARRAY, true);
    this.level = level;
    IteratorArray it = new IteratorArray(line);
    String mod = Symbol.getDefAlter(line);
    String type = Symbol.getDefType(line);
    String nameVar = Symbol.getDefName(it.getNext());

    // nome da variavel
    name = nameVar + getOriginalDims(line);

    int dimension = Integer.valueOf(it.getNext()); // numero de dimensoes

    data = new Vector<SymbolData>(dimension);

    nameVar = nameVar + it.getUnprocessed();

    nameVar = mod + " " + type + " " + nameVar;
    for (int i = 0; i < dimension; i++) {
      SymbolData var =
          Memory.makeNewSymbol(nameVar + Symbol.iniArray + i + Symbol.finArray, mem, level);
      var.normalizeName();
      data.add(var);
    }

    //        objectValue = data;

    // constructor
  }
Esempio n. 2
0
  // um Array de estruturas
  public SymbolArray(SymbolStructure model, String varName, int level) throws LanguageException {
    super(Symbol.ARRAY, true);
    this.level = level;
    IteratorArray it = new IteratorArray(varName);
    name = it.getNext(); // tirar as

    int dimension = Integer.valueOf(it.getNext());
    data = new Vector<SymbolData>(dimension); // construir um vector

    for (int i = 0; i < dimension; i++) {
      // SymbolStructure s = new SymbolStructure(model,name+ "[" + i + "]", level);
      SymbolData s = SymbolManager.getCloneStructure(model, name + "[" + i + "]", level);
      data.add(s);
    }
    // objectValue = data;
  }