diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-06-27 11:09:01 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-06-27 11:09:01 -0400 |
commit | 36a5048b543f8adf10782fccc7c01e906a585658 (patch) | |
tree | 500ff84226f0e694a984b2aff326ea9692ec08ca | |
parent | 7e47f52a21fb73dde9e59fe1f0b5957ec119ccfd (diff) |
figured out what the problem with the types test was
going to need a separate stage for figuring out #ifs or something
-rw-r--r-- | data_structures.c | 17 | ||||
-rw-r--r-- | identifiers.c | 4 | ||||
-rw-r--r-- | test.toc | 6 |
3 files changed, 26 insertions, 1 deletions
diff --git a/data_structures.c b/data_structures.c index 37ae242..af89aa4 100644 --- a/data_structures.c +++ b/data_structures.c @@ -378,6 +378,23 @@ static inline void *str_hash_table_get(StrHashTable *t, const char *str, size_t return slot->data; } +static void str_hash_table_fprint(StrHashTable *t, FILE *out) { + fprintf(out, "------- Hash table @ %p\n", (void *)t); + arr_foreach(t->slots, StrHashTableSlotPtr, slotp) { + StrHashTableSlot *slot = *slotp; + if (slot) { + fprintf(out, "| "); + fwrite(slot->str, 1, slot->len, out); + fprintf(out, "\n"); + } + } + fprintf(out, "------\n"); +} + +static void str_hash_table_print(StrHashTable *t) { + str_hash_table_fprint(t, stdout); +} + #if RUN_TESTS static void str_hash_table_test(void) { StrHashTable t; diff --git a/identifiers.c b/identifiers.c index 17bbd47..c3f64b7 100644 --- a/identifiers.c +++ b/identifiers.c @@ -212,6 +212,10 @@ static void idents_test(void) { } #endif +static void idents_print_all(Identifiers *idents) { + str_hash_table_print(&idents->table); +} + static int ident_index_in_decl(Identifier i, Declaration *d) { int index = 0; arr_foreach(d->idents, Identifier, j) { @@ -1 +1,5 @@ -#include "tests/std/mem.toc"; +#include "tests/std/io.toc", io; + +main ::= fn() { + io.puts("hi"); +} |