From 25347b1c18157810167c78454bf5154bd2492226 Mon Sep 17 00:00:00 2001 From: "Ian M." Date: Sun, 4 Oct 2026 22:01:15 +0000 Subject: parser: Add parse_token() stub Signed-off-by: Ian M. --- core/parser.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/core/parser.c b/core/parser.c index 6cf0a4e..a92c6cb 100644 --- a/core/parser.c +++ b/core/parser.c @@ -32,11 +32,30 @@ static const char *toktab[] = { [TT_COMMA] = LITTOK(",") }; +/* + * Parse a specific token + * + * @state: Assembler state machine + * @tok: Token to parse at + * + * Returns zero on success + */ +static int +parse_token(struct atas_state *state, struct atas_token *tok) +{ + if (state == NULL) { + return -1; + } + + printf("got token %s\n", TOK_STR(tok->type)); + return 0; +} + int atas_parse(struct atas_state *state) { - int error; struct atas_token tok; + int error; if (state == NULL) { return -1; @@ -48,7 +67,10 @@ atas_parse(struct atas_state *state) break; } - printf("got token %s\n", TOK_STR(tok.type)); + error = parse_token(state, &tok); + if (error < 0) { + return -1; + } } return 0; -- cgit v1.2.3