It also means that your Mediator/parser should never fail or crash because of a malformed command, or because a correctly formatted command that you did not implement is present in the inputs. A really useful command interpreter would give useful error messages about commands, such as ``wrong number of arguments'', or ``invalid argument type'', or even better ``second argument was int, expected string''. For our purposes it will be sufficient to print a single error message regardless of the error:
***** Error: Invalid Command.
Note that the asterisks (*****)are printed. Do NOT echo the
erroneous command. (You will only echo valid commands.)
Your parser must ignore blank lines completely. For all other lines which are not fully formed and correct commands you must print the above error. As with other parts of the project, your fault tolerant command parsing capabilities will be tested separately from the remaining requirements of the project. So if you can't get a fully error checking parser working you will not be hurt on the other parts of the project. You may assume that for commands other than error checking your parser, all commands will be upper case and there will be no spaces within a command. There will be no blank lines and all commands will be valid. We're not out to get you.
However, to receive full credit for fault tolerant command parsing, a
working parser cannot make any of the assumptions described in the previous
paragraph. Commands should be correctly interpreted regardless of case
(ie. CREATE_BASE and creaTe_baSE should both be interpreted
as the CREATE_BASE command). Note that now all commands should be
parsed to upper case. So create_base(CollegePark,5,6)) should be
parsed as CREATE_BASE(COLLEGEPARK,5,6)). This is Very easy to do
using the String.toUpperCase() command on the input line. Blank lines
should be ignored (in particular do not print extraneous
*****'s). Whitespace, in general, should be ignored when parsing
with one exception - any string (command name or string argument like base
name) cannot contain internal spaces. So a command like
create_base(College Park,5,6) should be flagged as invalid (a valid
version might look like create_base(CollegePark,5,6)).
Please note that this change in the error message format is necessary to facilitate on-line testing, making it easy to identify correct behavior in the presence of incorrect data.