Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support other bases than decimal for num literals #1798

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

yannham
Copy link
Member

@yannham yannham commented Feb 1, 2024

Closes #1796.

This PR adds support in the parser for number literals in hexadecimal, octal and binary notation, suitably prefixed with the common 0x, 0b and 0o. The documentation of the manual is updated accordingly.

The stdlib function std.string.to_number wasn't updated to handle those new representations. I'm not sure yet if we should or if it should be a different function, accepting for example a base b. Or do both (make to_number the more generic but add more focused functions for specific bases or notations). In the meantime, I stuck to the most restrictive choice. We can reconsider later.

This commit adds support in the parser for number literals in
hexadecimal, octal and binary notation, suitably prefixed with the
common `0x`, `0b` and `0o`. The documentation of the manual is updated
accordingly.
@yannham yannham requested review from jneem and vkleen February 1, 2024 17:53
@github-actions github-actions bot temporarily deployed to pull request February 1, 2024 17:57 Inactive
@yannham yannham added this pull request to the merge queue Feb 1, 2024
Merged via the queue into master with commit 6cf2902 Feb 1, 2024
5 checks passed
@yannham yannham deleted the feat/multi-bases-number-literals branch February 1, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for hexadecimal, octal and binary notation
2 participants