Refactored presult_t to include a stream pointer

So when a presult_t is constructed it holds an index to where it was
constructed in terms of the token stream.  This will be useful when
implementing an error checker in the preprocessing or result parsing
stages.
This commit is contained in:
2023-11-29 15:42:58 +00:00
parent 4cee61fc9e
commit 48d304056a
2 changed files with 84 additions and 63 deletions

View File

@@ -40,9 +40,9 @@ typedef enum
const char *perr_as_cstr(perr_t);
// TODO: Refactor parser.c
typedef struct
{
size_t stream_index;
inst_t instruction;
s_word address;
struct PLabel
@@ -60,12 +60,11 @@ typedef struct
} type;
} presult_t;
// TODO: Implement these
presult_t presult_label(const char *, size_t, s_word);
presult_t presult_label_ref(inst_t, const char *, size_t);
presult_t presult_instruction(inst_t);
presult_t presult_relative(inst_t, s_word);
presult_t presult_global(const char *, size_t, s_word);
presult_t presult_label(size_t, const char *, size_t, s_word);
presult_t presult_label_ref(size_t, inst_t, const char *, size_t);
presult_t presult_instruction(size_t, inst_t);
presult_t presult_relative(size_t, inst_t, s_word);
presult_t presult_global(size_t, const char *, size_t, s_word);
void presult_free(presult_t);
void presults_free(presult_t *, size_t);