lexer: Add token for '.struct' token

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-02-15 17:05:03 -05:00
parent 41f5633198
commit d437fb258f
3 changed files with 9 additions and 0 deletions

View File

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

View File

@@ -58,6 +58,7 @@ static const char *toktab[] = {
[TT_RBRACE] = qtok("}"),
[TT_SEMI] = qtok(";"),
[TT_F] = qtok(".f"),
[TT_STRUCT] = qtok(".struct"),
[TT_EXTERN] = qtok(".extern"),
[TT_DEFINE] = qtok("#define"),
[TT_IFDEF] = qtok("#ifdef"),

View File

@@ -19,6 +19,7 @@ typedef enum {
TT_RBRACE, /* '}' */
TT_SEMI, /* ';' */
TT_F, /* '.f' */
TT_STRUCT, /* '.struct' */
TT_EXTERN, /* '.extern' */
TT_DEFINE, /* '#define' */
TT_IFDEF, /* '#ifdef' */