Saturday, November 9, 2013

Recreator – Error Checks / Expression Mode

Some error checks were added to the recreator along with an expression test mode.  The first check is to make sure the string holding stack is empty upon returning from the main recreate routine.  Any items left on the stack are popped and appended to the output string prefixed by "NotEmpty" to indicate an error before returning.

However,  the expression test mode left the resulting string on the holding stack.  Therefore, a check was required for the expression test mode.  An expression mode flag argument was added to the recreate routine.  When set, the string on top of the holding stack is popped and appended to the output string.  This is followed by the check for an empty stack.

An error check was also added to the pop routine to make sure the holding stack is not empty.  If the stack is empty, the "<Empty>" string is returned to indicate an error.

The tester  translate input routine was modified to pass the expression mode flag to the recreate routine and to just use the output string returned (it is no longer necessary to pop from the holding stack of the recreator for expression mode).

[commit 2980b89a24]

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)