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

Digit separator doesn't parse with opening brace #881

Closed
wants to merge 1 commit into from

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented Dec 8, 2023

Fixes #862.

@ntrel
Copy link
Contributor Author

ntrel commented Dec 8, 2023

Note that keeping Cpp1 apostrophe as digit separator caused this parsing complication. Personally I think underscore reads much nicer (and is used in many other languages) and wouldn't need special tracking here.

@JohelEGP
Copy link
Contributor

JohelEGP commented Dec 8, 2023

The last point of #289 (comment) also addresses a comment about using something other than ' as a digit separator.

@gregmarr
Copy link
Contributor

gregmarr commented Dec 8, 2023

@ntrel It's possible that underscore would conflict with user defined literals.

@JohelEGP
Copy link
Contributor

JohelEGP commented Dec 8, 2023

Not really.
0_0 separates.
0_d UDLs.

@gregmarr
Copy link
Contributor

gregmarr commented Dec 8, 2023

This is a valid UDL. https://www.godbolt.org/z/sn8r9a3zv https://www.godbolt.org/z/PvnK3jvMj

double operator ""_0(const char* args);

@SebastianTroy
Copy link

SebastianTroy commented Dec 8, 2023 via email

@JohelEGP
Copy link
Contributor

JohelEGP commented Dec 8, 2023

No.
For ambiguities, see https://www.reddit.com/r/cpp/comments/18canwt/small_rant_the_comma_operator_is_one_of_the_worst/.
One example is f(1,2).
Is that 12, or 1 and 2?

@SebastianTroy
Copy link

SebastianTroy commented Dec 8, 2023 via email

@JohelEGP

This comment was marked as duplicate.

@hsutter
Copy link
Owner

hsutter commented Dec 14, 2023

Thanks for this! I appreciate the PR, but I ended up fixing it a different way (using a shortcut to try not to duplicate as much of numeric literal parsing during brace matching, but if we discover problems with that we can look at this PR again). Again, thanks very much.

@hsutter hsutter closed this Dec 14, 2023
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.

[BUG] Digit separator doesn't parse
5 participants