diff options
author | JSDurand <mmemmew@gmail.com> | 2022-01-31 15:59:11 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-01-31 15:59:11 +0800 |
commit | eb007d554251456a2a508849edf91b15aab1333e (patch) | |
tree | bd88e78debdd646da87aa60f1bf2904eaa4370ca /src/grammar.c | |
parent | a8bd5e9d85ac9928bd29add82e887f82642af893 (diff) |
cnp: save point
Now we need to implement predicates, in order to have practical
applications.
Diffstat (limited to 'src/grammar.c')
-rw-r--r-- | src/grammar.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/grammar.c b/src/grammar.c index 3b5a959..afb9353 100644 --- a/src/grammar.c +++ b/src/grammar.c @@ -44,6 +44,15 @@ rg_nth(CCR_MOD(Rule_group *) rg, NUM n) return (List *) list_nth(rg->rights, n); } +struct PT_DATA_s { + dfa *dfap; + /* NULL-terminated strings */ + char *user_name; + char *raw_name; +}; + +typedef struct PT_DATA_s PTD; + /* TODO: Add some statistic counts to assist the hash tables. For example, store the total number of terminals as an integer; then the hash table can be hinted at initialization to contain that many @@ -63,7 +72,8 @@ struct Grammar_s { To print them, first encode them into normal strings. */ List *names; - /* TODO: Add an array of predicates. */ + /* an array of predicates. */ + PTD *predicates; }; static void @@ -179,6 +189,7 @@ BOOL build_grammar(Grammar *g, const List *rules, CC_MOD(List *) names) { g->names = (List *) names; + g->predicates = NULL; NUM len = list_length(names); NUM rule_len = list_length(rules); |