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

add "allowHexadecimal" reader option #1510

Closed
wants to merge 8 commits into from

Conversation

Caldfir
Copy link

@Caldfir Caldfir commented Sep 17, 2023

Adds optional read-support for hexadecimal numbers matching 0x[0-9a-fA-F]{1,16} (size depends on LargestUInt). New capability is tied to the allowHexadecimal reader-option.

Not sure if there is much interest aside from myself. This would contribute to possible future JSON5 support which does seem to have been considered (#209 #723). Would need to support leading (+|-) for this to be compliant with the JSON5 spec.

else if (c >= '0')
c -= '0';
else
return addError("Contains non-hexadecimal digits.", token, current);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems that this wouldn't catch nonhex characters like 'z'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I think I had assumed that token.start/token.end were being set correctly by readHexadecimal(). It would make the method more robust and flexible to check both bounds though. Will fix.

@baylesj
Copy link
Contributor

baylesj commented Sep 12, 2024

Closing this due to inactivity. Feel free to reopen if you are able to address feedback.

@baylesj baylesj closed this Sep 12, 2024
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.

3 participants