diff options
| author | Ian M. <ian@aptel.org> | 2026-10-04 22:01:15 +0000 |
|---|---|---|
| committer | Ian M. <ian@aptel.org> | 2026-10-04 22:01:15 +0000 |
| commit | 25347b1c18157810167c78454bf5154bd2492226 (patch) | |
| tree | 3ead5e9136a22d17c25b1558a90c97160a188ef2 | |
| parent | f6c0a27feedb8258afbf10d64c7040e327377250 (diff) | |
parser: Add parse_token() stubmain
Signed-off-by: Ian M. <ian@aptel.org>
| -rw-r--r-- | core/parser.c | 26 |
1 files 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; |
