From a01075f6801f0310f3de4fe85f0d8ed2c21c47a9 Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Fri, 1 Aug 2025 18:42:28 -0400 Subject: add comments --- lex.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lex.c') diff --git a/lex.c b/lex.c index 7a1d345..12cd284 100644 --- a/lex.c +++ b/lex.c @@ -127,10 +127,19 @@ Token ident_to_keyword(Str ident) { #define T(t) (l->tok = t) void lex_next(Lexer *l) { +recurse: int i = l->ofs; + while (i < l->buf.n && is_space(l->buf.s[i])) { i++; } + + if (str_starts(str_skip(l->buf, i), S("/*"))) { + Str f = str_find(str_skip(l->buf, i), S("*/")); + l->ofs = (f.s - l->buf.s) + 2; + goto recurse; + } + int start_ofs = i; l->ident = (Str) { &l->buf.s[start_ofs], 0 }; if (i >= l->buf.n) { -- cgit v1.2.3