Skip to content

[Lexical] Undocumented HexFloat syntax #4149

@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

zxinsworld reported this on 2024-12-13T15:56:18Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24894

Description

This code compiles:
```d
void main(){
	float x = 0xp1;
}
```
However, the grammar in the spec doesn't list any way to write a HexFloat without leading digits:
```
HexFloat:
    HexPrefix HexDigitsNoSingleUS . HexDigitsNoStartingUS HexExponent
    HexPrefix . HexDigitsNoStartingUS HexExponent
    HexPrefix HexDigitsNoSingleUS HexExponent
```
So we need to either add ``HexPrefix HexExponent`` to the grammar, or deprecate``0xp1`` in case it wasn't meant to work in the first place.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions