aboutsummaryrefslogtreecommitdiffstats
path: root/src/analyse.h
diff options
context:
space:
mode:
authorkatherine <ageha@airen-no-jikken.icu>2019-07-10 20:24:08 -0700
committerkatherine <ageha@airen-no-jikken.icu>2019-07-10 20:24:08 -0700
commit06cb82a8ccc3587dff728321dff5416b18090483 (patch)
tree95dc02df244856b5ede95a3a1a44ea756e850203 /src/analyse.h
parent34271c906a2de43a68d2fa764d31e6f5b2c3299f (diff)
downloadconfconf-06cb82a8ccc3587dff728321dff5416b18090483.tar.gz
implement deftype get
Diffstat (limited to 'src/analyse.h')
-rw-r--r--src/analyse.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/analyse.h b/src/analyse.h
index 539e003..2e1556e 100644
--- a/src/analyse.h
+++ b/src/analyse.h
@@ -4,29 +4,35 @@
#include "tok.h"
#include "parse.h"
+#include "../reqs/uthash/include/uthash.h"
+
#include <stdbool.h>
/* 26 letters * 2 for case + 1 for '_' */
#define ANALYSE_MAX_BRANCH (26 * 2 + 1)
-struct analyse_tree_s {
- bool is_terminal;
- char name[TOK_MAX_LEN];
+struct analyse_trie_s {
+ /* NULL for non-terminals */
+ char *sval;
unsigned branch_count;
char branch_chars[ANALYSE_MAX_BRANCH];
- struct analyse_tree_s *branches[ANALYSE_MAX_BRANCH];
+ struct analyse_trie_s *branches[ANALYSE_MAX_BRANCH];
+ /* these two used for traversal */
+ struct analyse_trie_s *parent;
+ unsigned idx;
};
struct analyse_result_s {
bool uses_type[PARSE_TYPE_HASH_DEFTYPE];
bool uses_array;
bool uses_hash;
- struct analyse_tree_s deftype_tree;
- struct analyse_tree_s var_tree;
+ struct analyse_trie_s var_trie;
+ unsigned deftype_mem_trie_count;
+ struct analyse_trie_s *deftype_mem_tries;
};
-struct analyse_result_s analyse(struct parse_result_s pr);
+struct analyse_result_s* analyse(struct parse_result_s *pr);
-void analyse_result_wipe(struct analyse_result_s *r);
+void analyse_result_free(struct analyse_result_s *ar);
#endif