lexer: Add tokens for LPAREN + RPAREN

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-02-15 12:36:05 -05:00
parent 44017eb06f
commit 5baa20c892
3 changed files with 12 additions and 0 deletions

View File

@@ -259,6 +259,14 @@ lexer_scan(struct rifle_state *state, struct token *res)
res->type = TT_COLON;
res->c = c;
return 0;
case '(':
res->type = TT_LPAREN;
res->c = c;
return 0;
case ')':
res->type = TT_RPAREN;
res->c = c;
return 0;
default:
if (lexer_scan_ident(state, c, res) == 0) {
lexer_check_kw(state, res);

View File

@@ -41,6 +41,8 @@ static const char *toktab[] = {
[TT_STAR] = qtok("*"),
[TT_SLASH] = qtok("/"),
[TT_COLON] = qtok(":"),
[TT_LPAREN] = qtok("("),
[TT_RPAREN] = qtok(")"),
[TT_F] = qtok(".f"),
[TT_EXTERN] = qtok(".extern")
};

View File

@@ -12,6 +12,8 @@ typedef enum {
TT_STAR, /* '*' */
TT_SLASH, /* '/' */
TT_COLON, /* ':' */
TT_LPAREN, /* '(' */
TT_RPAREN, /* ')' */
TT_F, /* '.f' */
TT_EXTERN, /* '.extern' */
} tt_t;