lexer: Add token for '.pub' keyword

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-02-15 22:57:39 -05:00
parent 8d0c0520b5
commit 022770df16
3 changed files with 11 additions and 0 deletions

View File

@@ -208,6 +208,13 @@ lexer_check_direc(struct rifle_state *state, struct token *tok)
return;
}
break;
case 'p':
if (strcmp(tok->s, ".pub") == 0) {
tok->type = TT_PUB;
return;
}
break;
}
}

View File

@@ -72,6 +72,7 @@ static const char *toktab[] = {
[TT_F] = qtok(".f"),
[TT_STRUCT] = qtok(".struct"),
[TT_EXTERN] = qtok(".extern"),
[TT_PUB] = qtok(".pub"),
[TT_VOID] = qtok("void"),
[TT_U8] = qtok("u8"),
[TT_U16] = qtok("u16"),
@@ -520,6 +521,8 @@ parse_begin(struct rifle_state *state)
return -1;
}
break;
case TT_PUB:
break;
default:
utok1(state, &tok);

View File

@@ -22,6 +22,7 @@ typedef enum {
TT_F, /* '.f' */
TT_STRUCT, /* '.struct' */
TT_EXTERN, /* '.extern' */
TT_PUB, /* '.pub' */
TT_VOID, /* 'void' */
TT_U8, /* 'u8' */
TT_U16, /* 'u16' */