lexer: Add token for ','

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

View File

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

View File

@@ -57,6 +57,7 @@ static const char *toktab[] = {
[TT_LBRACE] = qtok("{"),
[TT_RBRACE] = qtok("}"),
[TT_SEMI] = qtok(";"),
[TT_COMMA] = qtok(","),
[TT_F] = qtok(".f"),
[TT_STRUCT] = qtok(".struct"),
[TT_EXTERN] = qtok(".extern"),

View File

@@ -18,6 +18,7 @@ typedef enum {
TT_LBRACE, /* '{' */
TT_RBRACE, /* '}' */
TT_SEMI, /* ';' */
TT_COMMA, /* ',' */
TT_F, /* '.f' */
TT_STRUCT, /* '.struct' */
TT_EXTERN, /* '.extern' */