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

[C] Add support for decimal floating-point types #4091

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

braewoods
Copy link
Contributor

This was introduced in C23 and adds support for the new type keywords, the new suffixes for the new types, and the new length modifiers for printf and scanf.

Furthermore, the existing matching rules for floats was changed to remove the possibility of '1f' being classified as a floating point literal. This is actually considered to be an integral literal with an invalid suffix instead of a floating point literal by all compilers that I know of and such produces compiler errors if such code is compiled.

@braewoods
Copy link
Contributor Author

The only part I believe to be questionable is the changes related to the 1f matching case. I removed it and updated the tests according because that simply is not valid C or C++ at all. It will be seen as an integer literal with the suffix of f or F which is a syntax error to any compiler I've ever used to my knowledge.

C++/C.sublime-syntax Outdated Show resolved Hide resolved
@braewoods
Copy link
Contributor Author

I have updated the commit to resolve the conflict.

@braewoods
Copy link
Contributor Author

This revises the matching rule to the simplified version presented earlier by @deathaxe.

This was introduced in C23 and adds support for the new type
keywords, the new suffixes for the new types, and the new
length modifiers for printf and scanf.

Furthermore, the existing matching rules for floats was changed
to remove the possibility of '1f' being classified as a floating
point literal. This is actually considered to be an integral
literal with an invalid suffix instead of a floating point literal
by all compilers that I know of and such produces compiler errors
if such code is compiled.
@braewoods
Copy link
Contributor Author

I've noticed that hexadecimal floats also need to be updated but I think that's best done in a different PR.

@deathaxe deathaxe merged commit 29b8a9c into sublimehq:master Nov 11, 2024
1 check passed
@braewoods braewoods deleted the c-decimal-types branch November 11, 2024 06:37
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