//
//  EXPForLoopStatement.m
//  dde
//
//  Created by ashley on 25/05/2008.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "EXPForLoopStatement.h"

@implementation EXPForLoopStatement

/* - (id) init
{
} */

- (void) setFromExp:(id)fromExp
{
	[fromExp retain];
	[_fromExp release];
	_fromExp = fromExp;
}

- (id) fromExp
{
	return _fromExp;
}

- (void) setToExp:(id)toExp
{
	[toExp retain];
	[_toExp release];
	_toExp = toExp;
}

- (id) toExp
{
	return _toExp;
}

- (void) setInDimension:(id)inDimension
{
	[inDimension retain];
	[_inDimension release];
	_inDimension= inDimension;
}

- (id) inDimension
{
	return _inDimension;
}

- (NSString *)elementType
{
	return @"forloop";
}

- (NSString *)description
{
	NSMutableString *desc = [[[NSMutableString alloc] init] autorelease];
	[desc appendString:@"for "];
	[desc appendString:[[self header] description]];
	if ([self inDimension]==nil) {
		[desc appendString:@" = "];
		[desc appendString:[[self fromExp] description]];
		[desc appendString:@" to "];
		[desc appendString:[[self toExp] description]];
	} else {
		[desc appendString:@" in "];
		[desc appendString:[[self inDimension] description]];
	}
	[desc appendString:@" do"];

	return desc;
}

- (void) dealloc
{
	[_fromExp release];
	[_toExp release];
	[_inDimension release];
	[super dealloc];
}

@end