Type* compileIndexes(Type* arrayType) {
  // parse a sequence of indexes, check the consistency to the arrayType, and return the element type
  Type *idxType = NULL;
  Type *elmType = NULL;

  while (lookAhead->tokenType == SB_LSEL) {
    eat(SB_LSEL);

    // if current element is not of array type,
    // then the access to the next dimension is invalid
    checkArrayType(arrayType);

    idxType = compileExpression();
    checkIntType(idxType);

    eat(SB_RSEL);

    // Down 1 level of dimension
    arrayType = arrayType->elementType;
  }

  // arrayType becomes elmType when we traverse to the last dimension
  elmType = arrayType;

  return elmType;
}
Type* compileIndexes(Type* arrayType) {
  // TODO: parse a sequence of indexes, check the consistency to the arrayType, and return the element type
  Type* type;
  while (lookAhead->tokenType == SB_LSEL) {
    eat(SB_LSEL);
    type = compileExpression();
    checkIntType(type);
    checkArrayType(arrayType);

    arrayType = arrayType->elementType;
    eat(SB_RSEL);
  }
  checkBasicType(arrayType);
  return arrayType;
}
Beispiel #3
0
Type* compileIndexes(Type* arrayType) {
  Type* type;

  
  while (lookAhead->tokenType == SB_LSEL) {
    eat(SB_LSEL);
    type = compileExpression();
    checkIntType(type);
    checkArrayType(arrayType);

    arrayType = arrayType->elementType;
    eat(SB_RSEL);
  }
  checkBasicType(arrayType);
  return arrayType;
}
Beispiel #4
0
Type* compileIndexes(Type* arrayType) {
  // TODO: Generate code for computing array element address
  Type* type;

  
  while (lookAhead->tokenType == SB_LSEL) {
    eat(SB_LSEL);
    type = compileExpression();
    checkIntType(type);
    checkArrayType(arrayType);

    arrayType = arrayType->elementType;
    eat(SB_RSEL);
  }
  checkBasicType(arrayType);
  return arrayType;
}
Beispiel #5
0
TTErr TTData::ArrayInit()
{
    // reset initialisation state
    mInitialized = NO;
    
    // if valueDefault type is right
	if (checkArrayType(mValueDefault))
		if (!(mValueDefault.empty()))
        {
            TTValue empty;
			this->Command(mValueDefault, empty);
        }
    
    // notify observers about the initialization state
	initializedAttribute->sendNotification(kTTSym_notify, mInitialized);
    
    return kTTErrNone;
}