From aae74f06ed334ab403bc1150f1bf4214a0532b65 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 17 Feb 2026 01:10:48 -0500 Subject: [PATCH] lexer: Add token for 'loop' keyword Signed-off-by: Ian Moffett --- core/lexer.c | 7 +++++++ core/parser.c | 1 + inc/rifle/token.h | 1 + 3 files changed, 9 insertions(+) diff --git a/core/lexer.c b/core/lexer.c index ff028f7..def73d0 100644 --- a/core/lexer.c +++ b/core/lexer.c @@ -284,6 +284,13 @@ lexer_check_kw(struct rifle_state *state, struct token *tok) return; } + break; + case 'l': + if (strcmp(tok->s, "loop") == 0) { + tok->type = TT_LOOP; + return; + } + break; case '.': lexer_check_direc(state, tok); diff --git a/core/parser.c b/core/parser.c index 7061314..b4b4d1d 100644 --- a/core/parser.c +++ b/core/parser.c @@ -75,6 +75,7 @@ static const char *toktab[] = { [TT_EXTERN] = qtok(".extern"), [TT_PUB] = qtok(".pub"), [TT_RETURN] = qtok("return"), + [TT_LOOP] = qtok("loop"), [TT_VOID] = qtok("void"), [TT_U8] = qtok("u8"), [TT_U16] = qtok("u16"), diff --git a/inc/rifle/token.h b/inc/rifle/token.h index e5c10ec..4374294 100644 --- a/inc/rifle/token.h +++ b/inc/rifle/token.h @@ -25,6 +25,7 @@ typedef enum { TT_EXTERN, /* '.extern' */ TT_PUB, /* '.pub' */ TT_RETURN, /* 'return' */ + TT_LOOP, /* 'loop' */ TT_VOID, /* 'void' */ TT_U8, /* 'u8' */ TT_U16, /* 'u16' */