lexer: Add tokens for LBRACE and RBRACE

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-02-15 16:30:16 -05:00
parent 48c2e7eb73
commit babcf9d3cf
3 changed files with 12 additions and 0 deletions

View File

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

View File

@@ -53,6 +53,8 @@ static const char *toktab[] = {
[TT_COLON] = qtok(":"),
[TT_LPAREN] = qtok("("),
[TT_RPAREN] = qtok(")"),
[TT_LBRACE] = qtok("{"),
[TT_RBRACE] = qtok("}"),
[TT_F] = qtok(".f"),
[TT_EXTERN] = qtok(".extern"),
[TT_DEFINE] = qtok("#define"),

View File

@@ -14,6 +14,8 @@ typedef enum {
TT_COLON, /* ':' */
TT_LPAREN, /* '(' */
TT_RPAREN, /* ')' */
TT_LBRACE, /* '{' */
TT_RBRACE, /* '}' */
TT_F, /* '.f' */
TT_EXTERN, /* '.extern' */
TT_DEFINE, /* '#define' */