diff --git a/core/lexer.c b/core/lexer.c index 8d7d09e..d59c82f 100644 --- a/core/lexer.c +++ b/core/lexer.c @@ -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; } } diff --git a/core/parser.c b/core/parser.c index 62fbcf2..ab40310 100644 --- a/core/parser.c +++ b/core/parser.c @@ -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"), diff --git a/inc/rifle/token.h b/inc/rifle/token.h index a1150cf..d4f98c7 100644 --- a/inc/rifle/token.h +++ b/inc/rifle/token.h @@ -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' */