Skip to content

[Lexer] Add a few test cases for hex number literal #3132

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jun 22, 2016

What's in this pull request?

Follow up on #3124.
Added several test cases.

@rintaro
Copy link
Member Author

rintaro commented Jun 22, 2016

@swift-ci Please test and merge

@swift-ci swift-ci merged commit a33e608 into swiftlang:master Jun 22, 2016
@rintaro rintaro deleted the SR-1724-hexnumber-literal-addtest branch June 22, 2016 13:03
@jckarter
Copy link
Contributor

There's also the case of 0x1.p or 0x1.p2. The first one isn't a valid float literal, but the second one is a toss-up—it'd be accepted as a float literal in C, at least.

@jckarter
Copy link
Contributor

I guess we already diverge from C by requiring a digit after the dot in decimal literals (IOW 1. isn't accepted) so it'd be reasonable to require the same of hex float literals.

@rintaro
Copy link
Member Author

rintaro commented Jun 22, 2016

Current published specification requires "." ­hexadecimal-digit ....
So as implementation: https://github.com/apple/swift/blob/a5eed38/lib/Parse/Lexer.cpp#L872-L877

­

@jckarter
Copy link
Contributor

Makes sense, thanks. Got time to add those as test cases then?

@rintaro
Copy link
Member Author

rintaro commented Jun 22, 2016

I'd be happy to do that, but I'm very tired today.
I will do that in tomorrow. (in Japan).

@jckarter
Copy link
Contributor

No problem, thanks for fixing this!

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