fix: parse YAML 1.2 octal scalars (0o prefix) as integers#1451
Open
raphaelroshan wants to merge 1 commit into
Open
fix: parse YAML 1.2 octal scalars (0o prefix) as integers#1451raphaelroshan wants to merge 1 commit into
raphaelroshan wants to merge 1 commit into
Conversation
3331445 to
2ca3378
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1251.
YAML 1.2 writes octal as
0o17, butas<int>()failed on it because std::stringstream's octal parsing only understands the C-style0prefix.Normalize
0o/0Oto a leading0before the stream conversion, so both the 1.1 (0123) and 1.2 (0o123) spellings decode. Hex and decimal are unchanged. As per the discussion in the issue, adding a functionNormalizeOctalPrefixthat should help to support backward compatibility. Added a test covering octal, signed/unsigned, hex and decimal.Do let me know if i misinterpreted the behavior required!