Friday, January 16, 2015

Token – Table Entry Member

The code member of the token class was replaced with a table entry pointer member.  The index member, which gets set to the offset within the program line when the tokens of the line are encoded.  These offsets will be used later as more BASIC commands are implemented (for example IF-THEN statements).  Accordingly, this member along with its access functions were renamed to offset.

The reason for this change was that the index name is more appropriate for the code index stored in the program code.  The code access function was renamed to index.  This function formally returned the value of the code member and was changed to call the index table access function, itself also being renamed from code.  The return types of these functions were changed from the Code enumeration to an integer.  This table function still returns the index of the table entry, but a type cast is not needed anymore.

Accesses to the code member were changed to use the table entry pointer member.  Uses of the table access function internally within the token class were changed to use the new member directly.  There were a number of uses of the table access function external to the token class.  Sufficient pass-through table access functions were added to the token class making the use of this access function unnecessary.  Callers were updated to remove this extra call.  Pass-through functions were not added for the table entry function pointer members as these will be changed to virtual member functions.

The table access function was renamed to table entry to be consistent with the set table entry access function.  The order of the token access functions were arranged to the same order as the member and extra comments were removed.

[branch table commit 2a0a6f2fa3]