aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scan.c4
-rw-r--r--tests/float-const-leading-dot.c1
-rw-r--r--tests/float-const-leading-dot.qbe1
3 files changed, 6 insertions, 0 deletions
diff --git a/scan.c b/scan.c
index 8db5136..59861de 100644
--- a/scan.c
+++ b/scan.c
@@ -336,6 +336,10 @@ again:
return TRBRACE;
case '.':
nextchar(s);
+ if (isdigit(s->chr)) {
+ bufadd(&s->buf, '.');
+ return number(s);
+ }
if (s->chr != '.')
return TPERIOD;
loc = s->loc;
diff --git a/tests/float-const-leading-dot.c b/tests/float-const-leading-dot.c
new file mode 100644
index 0000000..bfed54a
--- /dev/null
+++ b/tests/float-const-leading-dot.c
@@ -0,0 +1 @@
+float x = .5;
diff --git a/tests/float-const-leading-dot.qbe b/tests/float-const-leading-dot.qbe
new file mode 100644
index 0000000..12ae325
--- /dev/null
+++ b/tests/float-const-leading-dot.qbe
@@ -0,0 +1 @@
+export data $x = align 4 { s s_0x1p-1, }