Skip to content

Commit 820535d

Browse files
author
Daniel Kroening
committed
variations on hex float constants
1 parent 7297453 commit 820535d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

regression/ansi-c/float_constant1/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ STATIC_ASSERT(0x1.0p-95f == 2.524355e-29f);
77
// also with upper case X, P, F
88
STATIC_ASSERT(0X1.0P-95F == 2.524355e-29f);
99

10+
// nothing before the dot
11+
STATIC_ASSERT(0X.0p+1f == 0);
12+
1013
#ifdef __GNUC__
1114
_Complex c;
1215
#endif

src/ansi-c/scanner.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ fraction {integer}
167167
float1 {integer}"."{fraction}?({exponent})?
168168
float2 "."{fraction}({exponent})?
169169
float3 {integer}{exponent}
170-
hexfloat1 "0"[xX]{hexdigit}+"."{hexdigit}+[pP][+-]?{integer}
171-
hexfloat2 "0"[xX]{hexdigit}+"."[pP][+-]?{integer}
172-
hexfloat3 "0"[xX]{hexdigit}+[pP][+-]?{integer}
170+
hexfloat1 "0"[xX]{hexdigit}*"."{hexdigit}+[pP][+-]?{integer}
171+
hexfloat2 "0"[xX]{hexdigit}*"."[pP][+-]?{integer}
172+
hexfloat3 "0"[xX]{hexdigit}*[pP][+-]?{integer}
173173
float_suffix [fFlLiIjJ]*
174174
gcc_ext_float_suffix [wWqQ]|[dD][fFdDlL]?
175175
float {float1}|{float2}|{float3}|{hexfloat1}|{hexfloat2}|{hexfloat3}

0 commit comments

Comments
 (0)