From bc32ed90d6eaaca6406998961c50c5f5d5ca5260 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 8 Aug 2022 09:19:07 +0200 Subject: lexing fix --- bootstrap/parse.c | 5 ++++- bootstrap/test2.cff | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'bootstrap') diff --git a/bootstrap/parse.c b/bootstrap/parse.c index 3e14dc3..706bfb5 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -136,9 +136,12 @@ aishsep(char c) { static int readtilhsep(struct parser *P, char *buf, int n, bool dot) { int i = 0; + bool (*pred)(char) = aishsep; u8 c; - while (!aishsep((c = chrpeek(P))) || (dot && c == '.')) { + while (!pred((c = chrpeek(P))) || (dot && c == '.')) { chr(P); + if (!aissep(c)) + pred = aissep; if (i >= n - 1) return -1; buf[i++] = c; diff --git a/bootstrap/test2.cff b/bootstrap/test2.cff index ec5fcb0..83e12fe 100644 --- a/bootstrap/test2.cff +++ b/bootstrap/test2.cff @@ -42,9 +42,11 @@ extern fn main() void { case Int i; i; case Flo *f; + let x f32 = *f; } let t = v.#tag; let i = v.Int; + ! v.#tag++; #:outer for let i = 0; i++ < 10; { printf("%d\n", i); -- cgit v1.2.3