lexer: Add token for semicolon

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-02-15 16:31:46 -05:00
parent babcf9d3cf
commit 378259a873
3 changed files with 6 additions and 0 deletions

View File

@@ -333,6 +333,10 @@ lexer_scan(struct rifle_state *state, struct token *res)
res->type = TT_RBRACE;
res->c = c;
return 0;
case ';':
res->type = TT_SEMI;
res->c = c;
return 0;
case '#':
if ((c = lexer_nom(state, false)) == '\0') {
trace_error(state, "unexpected end of file\n");

View File

@@ -55,6 +55,7 @@ static const char *toktab[] = {
[TT_RPAREN] = qtok(")"),
[TT_LBRACE] = qtok("{"),
[TT_RBRACE] = qtok("}"),
[TT_SEMI] = qtok(";"),
[TT_F] = qtok(".f"),
[TT_EXTERN] = qtok(".extern"),
[TT_DEFINE] = qtok("#define"),

View File

@@ -16,6 +16,7 @@ typedef enum {
TT_RPAREN, /* ')' */
TT_LBRACE, /* '{' */
TT_RBRACE, /* '}' */
TT_SEMI, /* ';' */
TT_F, /* '.f' */
TT_EXTERN, /* '.extern' */
TT_DEFINE, /* '#define' */