cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit 9c824820b0add0bd840fb559fa4e98afea65986b
parent 4a17a825e5944041bbcd4aed6a85fb7590247a62
Author: Michael Forney <mforney@mforney.org>
Date:   Tue, 12 Mar 2019 16:28:06 -0700

scan: Accept leading `.` in pp-number

Diffstat:
Mscan.c | 4++++
Atests/float-const-leading-dot.c | 1+
Atests/float-const-leading-dot.qbe | 1+
3 files changed, 6 insertions(+), 0 deletions(-)

diff --git 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 @@ -0,0 +1 @@ +float x = .5; diff --git a/tests/float-const-leading-dot.qbe b/tests/float-const-leading-dot.qbe @@ -0,0 +1 @@ +export data $x = align 4 { s s_0x1p-1, }