fragment FloatLiteralExponent: [eE] (PLUS | MINUS)? DecimalIntegerLiteral;
FloatLiteral:
// 1_123e-3, 123e+4 or 123E5 (needs the exponent or it's just an integer)
DecimalIntegerLiteral FloatLiteralExponent
// .1234_5678 or .1e3 (no digits before the dot)
| DOT DecimalIntegerLiteral FloatLiteralExponent?
// 123.456, 123. or 145.32e+1_00
| DecimalIntegerLiteral DOT DecimalIntegerLiteral? FloatLiteralExponent?;
Floats with leading
DOT
fail to parse. Example values that fail parsing:.1234_5678
.1e3
.1e-3
From the spec:
Example test:
Example output: