From e8e6feeb95cdc3b81a2c17b5a342a3d0b170ccb4 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Tue, 22 Feb 2022 12:29:23 +0000 Subject: Prepare for error guards --- lexer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lexer.c') diff --git a/lexer.c b/lexer.c index 0024320..4e9a4e4 100644 --- a/lexer.c +++ b/lexer.c @@ -88,11 +88,18 @@ lexline(InputStream *input, int toplevel) }else if(!toplevel && peek == ':'){ Rune buf[MAX_LINE_LENGTH]; Rune *p = buf; + int errorguard = 0; + if(getrune(input) == ':') + errorguard = 1; + else + ungetrune(input); + while((peek = getrune(input)) != L'⋄' && peek != '\n' && !inputEOF(input)) *p++ = peek; *p = 0; ungetrune(input); stmt->guard = lexlinestr(buf, toplevel); + stmt->errorguard = errorguard; stmt->ntoks--; }else if(peek == '{'){ int unclosed = 1; -- cgit v1.2.3