Sub-string assignments were implemented as described on the two posts from Sunday. In the LET translate routine, a flag was added, which is set if any of the assignments are a sub-string assignment. Before converting the comma or equal token to an assign code, the token on top of the done stack is checked to see if its code's table entry has the sub-string flag. If it does, the comma or equal token is deleted since it will not be used and the sub-string function is popped from the done stack, converted to the appropriate assign sub-string code and pushed to the local token stack.
After the equal token is received, and the tokens on the local token stack are processed, if the stack is not empty after popping the last token (indicating a multiple assignment) and there is a sub-string assignment (the new flag is set), then starting with the first token, each assign token is converted to an AssignKeep token (included a regular AssignStr code) and appended to the RPN output list. This continues until the last token is popped, which is appended to the output as a regular assign code by the process final operand routine.
Translator tests #4 (sub-string assignments) and #5 (LET commands) now work with the new translator routines except for a single PRINT command at the end of test #5 (which for now reports a "not yet implemented" bug error). Because of the change in sub-string assignment translations, the expected results were updated. As a result, the old translator will fail with these tests. The old results files for these tests were temporarily saved for reference. The temporary memory test script was updated to include these tests. See the commit log for more details of the changes made to implement sub-string assignments.
[commit e56db8f188]
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.)