/**
 * A parsed statement.
 * Can be one of several types.  An assignment statement, a conditional
 * statement or just a plain command.
 */

/*
 * $Id$
 */
public class Statement
{
	/*
	 * Possible types of statements.
	 */
	public static final int ASSIGN = 1;
	public static final int CONDITION = 2;

	public static final int COLOR = 3;
	public static final int LINEWIDTH = 4;
	public static final int MOVE = 5;
	public static final int DRAW = 6;
	public static final int STROKE = 7;
	public static final int NEWPAGE = 8;
	public static final int PRINT = 9;
	
	private int mType;
	Statement mThenStatement;
	Statement mElseStatement;
	String mAssignedVariable;

	Expression []mExpressions;

	/**
	 * Looks up identifier for a statement name.
	 * @param s is the name of the statement.
	 * @returns numeric code for this statement, or -1 if statement
	 * is unknown.
	 */
	public static int getStatementType(String s)
	{
		int retval = -1;
		String sLower = s.toLowerCase();

		if (sLower.equals("color") || sLower.equals("colour"))
		{
			retval = COLOR;
		}
		else if (sLower.equals("linewidth"))
		{
			retval = LINEWIDTH;
		}
		else if (sLower.equals("move"))
		{
			retval = MOVE;
		}
		else if (sLower.equals("draw"))
		{
			retval = DRAW;
		}
		else if (sLower.equals("stroke"))
		{
			retval = STROKE;
		}
		else if (sLower.equals("newpage"))
		{
			retval = NEWPAGE;
		}
		else if (sLower.equals("print"))
		{
			retval = PRINT;
		}
		return(retval);
	}
	
	/**
	 * Creates a plain statement.
	 * @param type is the type of statement.
	 * @param expressions are the arguments for this statement.
	 */
	public Statement(int type, Expression []expressions)
	{
		mType = type;
		mExpressions = expressions;
	}

	/**
	 * Create an assignment statement.
	 * @param variableName is the name of the variable being assigned.
	 * @param value is the value being assigned to this variable.
	 */
	public Statement(String variableName, Expression value)
	{
		mType = ASSIGN;
		mAssignedVariable = variableName;
		mExpressions = new Expression[1];
		mExpressions[0] = value;
	}

	/**
	 * Creates a conditional statement.
	 * @param type is the type of statement.
	 * @param expressions are the arguments for this statement.
	 */
	public Statement(Expression condition,
		Statement thenStatement, Statement elseStatement)
	{
		mType = CONDITION;
		mExpressions = new Expression[1];
		//mExpressions[0] = value;
	}

	public int getType()
	{
		return(mType);
	}

	public Expression []getExpressions()
	{
		return(mExpressions);
	}

	public String getAssignedVariable()
	{
		return(mAssignedVariable);
	}
		
	public Statement getThenStatement()
	{
		return(mThenStatement);
	}

	public Statement getElseStatement()
	{
		return(mElseStatement);
	}
}

@@ -479,16 +479,87 @@
 KE = 7;%0A
+%09public static final int FILL = 8;%0A%09public static final int SCALE = 9;%0A
 %09public 
@@ -585,17 +585,18 @@
 WPAGE = 
-8
+10
 ;%0A%09publi
@@ -622,17 +622,18 @@
 PRINT = 
-9
+11
 ;%0A%09%0A%09pri
@@ -1377,24 +1377,146 @@
 STROKE;%0A%09%09%7D%0A
+%09%09else if (sLower.equals(%22fill%22))%0A%09%09%7B%0A%09%09%09retval = FILL;%0A%09%09%7D%0A%09%09else if (sLower.equals(%22scale%22))%0A%09%09%7B%0A%09%09%09retval = SCALE;%0A%09%09%7D%0A
 %09%09else if (s

Add fill, scale.