Saturday, November 23, 2013

Recreator – Colons

Colons between statements are handled by setting the colon sub-code of the last token of a statement.  To support the recreation of colons, a check was added to the main recreator loop after the check for the parentheses sub-code that if the colon sub-code is set, a colon and a space is added to the output string.

This change caused a slight problem with the recreation of the remark operator if there is a colon just before the remark.  Two spaces were being added in front of the "'" operator.  To prevent this, a check was added after a non-empty output string check to also not add a space if the last character in the output string is already a space.

A new last access function was added to the recreator class that returns the last character in the output string or a null character if the output string is empty.  The expected recreated outputs for translator test  #16 (colon tests) were updated and are recreated correctly.

[commit fc90cf0e32]

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.)