Skip to content

Reinforce readToken function #1012

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

Merged
merged 1 commit into from
Sep 16, 2019

Conversation

dota17
Copy link
Member

@dota17 dota17 commented Aug 23, 2019

Add case "+" in readToken to allow it to read explicit positive number token.

@dota17 dota17 force-pushed the reinforce_readToken branch from 7fdecd2 to 51b3f52 Compare August 23, 2019 07:40
@dota17 dota17 force-pushed the reinforce_readToken branch from 51b3f52 to 00be3b2 Compare August 23, 2019 07:47
@baylesj
Copy link
Contributor

baylesj commented Aug 26, 2019

What is the use case for this? "+" tokens are not part of ECMAScript, RFC 7159, or json.org grammars. Is someone wanting this?

@dota17
Copy link
Member Author

dota17 commented Aug 27, 2019

What is the use case for this? "+" tokens are not part of ECMAScript, RFC 7159, or json.org grammars. Is someone wanting this

In some special usage scenarios, like the dial codes {"BOSTON" : +1-617}, we do need to parse these cases, so we can use this case with the switch allowSpecialFloats_, just like we deal with NaN or Infinity.

@baylesj
Copy link
Contributor

baylesj commented Sep 16, 2019

For dial codes, I would expect string representation, e.g.

"BOSTON": "+1-617"

Since 1-617 isn't a valid number anyway.

I still don't think we need this. Do we have clients wanting this? I'm especially concerned because if +Infinity is different than Infinity, we don't appear to preserve the "+" after parsing.

@baylesj baylesj merged commit 2cb9a58 into open-source-parsers:master Sep 16, 2019
@dota17 dota17 deleted the reinforce_readToken branch September 17, 2019 03:12
dawesc pushed a commit to EFTlab/jsoncpp that referenced this pull request Sep 25, 2019
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.

2 participants