aboutsummaryrefslogtreecommitdiffstats
path: root/src/analyse.h
diff options
context:
space:
mode:
authorkatherine <shmibs@airen-no-jikken.icu>2019-05-20 19:23:47 -0700
committerkatherine <shmibs@airen-no-jikken.icu>2019-05-20 19:23:47 -0700
commit24eeb2825c9f755c92812ec3a257e6709ccb6576 (patch)
treead7f22f0bf1865de584bd4e1244fc336233af279 /src/analyse.h
parent326646d14100c43f8cb64e7673f36fcc2b01eb6d (diff)
downloadconfconf-24eeb2825c9f755c92812ec3a257e6709ccb6576.tar.gz
implement analyse function
anlyises the parse results to build a tree for deterministic parser generation
Diffstat (limited to 'src/analyse.h')
-rw-r--r--src/analyse.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/analyse.h b/src/analyse.h
new file mode 100644
index 0000000..8e21db7
--- /dev/null
+++ b/src/analyse.h
@@ -0,0 +1,29 @@
+#ifndef CONFCONF_ANALYSE_H
+#define CONFCONF_ANALYSE_H
+
+#include "tok.h"
+#include "parse.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];
+ unsigned branch_count;
+ char branch_chars[ANALYSE_MAX_BRANCH];
+ struct analyse_tree_s *branches[ANALYSE_MAX_BRANCH];
+};
+
+struct analyse_result_s {
+ struct analyse_tree_s deftype_tree;
+ struct analyse_tree_s var_tree;
+};
+
+struct analyse_result_s analyse(struct parse_result_s pr);
+
+void analyse_result_wipe(struct analyse_result_s *r);
+
+#endif