diff options
Diffstat (limited to 'Scope.h')
-rw-r--r-- | Scope.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +#pragma once +#include <xxhash.h> + +#define SCOPE_WORD_MAX 256 + +/* member strings are borrowed and shouldn't be freed by the node */ +typedef struct Scope Scope; +struct Scope { + int used; + const char *words[SCOPE_WORD_MAX]; + int values[SCOPE_WORD_MAX]; + XXH32_hash_t words_hash[SCOPE_WORD_MAX]; + const Scope *parent; +}; + +Scope *scope_create(const Scope *parent); +int scope_insert(Scope *scope, const char *word, int value); |