Added based-constants and character constants #262
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ANS2012 requires the recognition of the following constants:
#1234
- a decimal number$1234
- a hexadecimal number%1010
- a binary number'W'
- a character constantNUMBER now pushes the base at the beginning, modifies the base if appropriate, processes the number like before (including negative signs and a . on the end for a double), and restores the base at the end. Character constants are handled directly by putting the ASCII value on the stack as a single. Not all characters can be used as caracter constants (eg.
' '
for a space will not work and there are no escaped characters supported so no way to get a newline - use a hex/dec/bin constant instead for those situations)Tests have been added to the core_c.fs file to test positive/negative single/double based numbers in both decimal and hex modes, as well as a few select character constants.
Note: Because there are other outstanding pull requests, the taliforth-py65mon.bin and listings in /docs were not included in this pull request. Just issue a "make" (or "make -B" to guarantee everything is rebuilt) after this has been merged and then push the result. A "make tests" before pushing might be in order as well, just to double check.