summaryrefslogtreecommitdiff
path: root/Scope.h
diff options
context:
space:
mode:
Diffstat (limited to 'Scope.h')
-rw-r--r--Scope.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Scope.h b/Scope.h
new file mode 100644
index 0000000..e5adacd
--- /dev/null
+++ b/Scope.h
@@ -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);