Friday, September 6, 2013

Pre-Encoder Issues – Blank Lines

The final issue is the ability to handle (allow) blanks lines.  When using test mode, lines that are blank or begin with a '#' character are ignored and never passed to the translator.  However, blank lines are allowed in the GUI and the translator returned an "expected command" error for blank lines.

It was necessary to prevent these errors for the GUI and it is desirable for the encoder test mode to allow blank lines since the end result of the encoder will be to insert actual code into the program and blank lines need to be allowed.

A simple change was made to the get commands routine after getting the first token of a command.  If this token is an end-of-line, and only if the RPN output list is empty, the done status is returned.  If the output list is not empty, then there was a preceding colon statement separator and an end-of-line is not allowed (a command is expected).

The text output routine for the RPN list class used by the test code already allowed for a blank line (an empty output list), as the for loop that gets the text for each RPN item in the list, simply terminates and an empty string is returned.

This change currently can't be tested using the command line test modes since blank lines are ignored with test input files, and a blank line entered in input entry test mode causes the application to exit.  However, the proper handling of blank lines can be seen using the GUI.

[commit 637eb58ea5]