From 3fb5430080199a6d92a63f8259fe4a88df9b83ba Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 1 Feb 2022 12:22:34 +0800 Subject: need to stop abusing hash tables Hash tables take too much space! If I use hash tables, the length of the input will be severely limited, to an unacceptable extent. So we have to use arrays instead. --- src/grammar.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/grammar.h') diff --git a/src/grammar.h b/src/grammar.h index d51c612..fd8d5c9 100644 --- a/src/grammar.h +++ b/src/grammar.h @@ -55,7 +55,7 @@ typedef unsigned long PT; * PT_DFA, * PT_SPECIAL * }; - * + * * typedef enum PT_TYPE_e PT_TYPE; */ /* T or NT @@ -70,6 +70,14 @@ enum TNT_TYPE_e { typedef enum TNT_TYPE_e TNT_TYPE; +typedef struct PT_DATA_s PTD; + +/* On error return NULL */ +PTD *new_ptd(str *user_name, str *raw_name, dfa *dfap); + +/* FLAG is used to destroy the strings contained within */ +void destroy_ptd(PTD *p, int flag); + /* If a TNT of type TERMINAL has value END_OF_INPUT, then it means, surprisingly, the end of input. */ enum { END_OF_INPUT = -1 }; @@ -98,8 +106,8 @@ typedef struct Grammar_s Grammar; NAMES is a list of CPA pointers. */ BOOL -build_grammar(Grammar *g, - const List *rules, CC_MOD(List *) names); +build_grammar(Grammar *g, const List *rules, + CC_MOD(List *) names, CC_MOD(List *) predicates); /* This accepts one and only one optional argument, which is of type either T, NT, or PT, depending on TYPE. */ -- cgit v1.2.3-18-g5258