lexer: add token for 'break' keyword

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-02-24 22:32:54 -05:00
parent fa4f8f7825
commit 4325c809a1
3 changed files with 9 additions and 0 deletions

View File

@@ -291,6 +291,13 @@ lexer_check_kw(struct rifle_state *state, struct token *tok)
return;
}
break;
case 'b':
if (strcmp(tok->s, "break") == 0) {
tok->type = TT_BREAK;
return;
}
break;
case '.':
lexer_check_direc(state, tok);

View File

@@ -75,6 +75,7 @@ static const char *toktab[] = {
[TT_EXTERN] = qtok(".extern"),
[TT_PUB] = qtok(".pub"),
[TT_RETURN] = qtok("return"),
[TT_BREAK] = qtok("break"),
[TT_LOOP] = qtok("loop"),
[TT_VOID] = qtok("void"),
[TT_U8] = qtok("u8"),

View File

@@ -25,6 +25,7 @@ typedef enum {
TT_EXTERN, /* '.extern' */
TT_PUB, /* '.pub' */
TT_RETURN, /* 'return' */
TT_BREAK, /* 'break' */
TT_LOOP, /* 'loop' */
TT_VOID, /* 'void' */
TT_U8, /* 'u8' */