There were many alternate codes that couldn't be initialized automatically like with operators and internal functions. These codes include the assignment, sub-string assignment, internal command (for INPUT and PRINT) and codes with operators. For now these other alternate codes need to be initialized manually.
An Alternate Information structure was added containing the primary code, the array index for the alternate codes and a initializer list of alternate codes. An initializer list of these structures was added containing the information for all of these other alternate codes. After iterating through the list of entries, the constructor iterates through this initializer list to add these other alternate codes to the alternate code map.
The rest of the uses of the associated code arrays were changed to use the alternate code map including the set token code function (used to set the code in a token, possibly an alternate code, depending on its data type), the LET translate function (for setting a sub-string assignment, string keep assignment and list assignment codes), and the INPUT translate function (for setting an input parse code).
The check in the constructor for validating the second associated code index was removed. The section for setting the expected data type of an operator or internal function was modified to use the alternate code map. This required a separate entry iteration loop since the alternate code map needs to be initialized completely before looking at the alternate codes.
There was problem with the automatic alternate code map initialization because of the current order of entries. The issue was that the binary operators with two integer operands was being made an alternate code of the operator with first integer and second double operand. This was different than how the associated code arrays were initialized. Instead of moving all of these entries (and their enumerators), a check was added to the alternate map initialization to check for with situation and to swap the entries.
Two additional checks were added to the alternate map initialization to make sure the primary binary operator code has operands with the same data type, throwing an error if not. In the check if a multiple internal function code with the greater number of operands is before the code with less operands had to also set the Multiple flag. The code with less operands was already being made the primary code.
[branch table commit d38f79b8a1]
Thursday, December 18, 2014
Subscribe to:
Post Comments (Atom)
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.)