summaryrefslogtreecommitdiff
path: root/src/grammar.h
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-02-08 00:29:10 +0800
committerJSDurand <mmemmew@gmail.com>2022-02-08 12:33:05 +0800
commit5426d9e2a6b820e34809d639838b26643df9ab17 (patch)
tree111f2b478b671092e3f2e64a6171970b8a5cdf99 /src/grammar.h
parentaaa12504c6095b2cdfa213a3d4b269bbd5e7038a (diff)
fix errorsHEADmaster
There are multiple subtle errors in the previous version, both in the codes and in the description of the BNF format. This version should fix some problems now. This version can successfully parse the grammar of its own grammar format, which is quite nice. See test/check_reader.c for parsing this format.
Diffstat (limited to 'src/grammar.h')
-rw-r--r--src/grammar.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/grammar.h b/src/grammar.h
index 89a66ba..bf418e0 100644
--- a/src/grammar.h
+++ b/src/grammar.h
@@ -75,6 +75,8 @@ typedef struct PT_DATA_s PTD;
/* On error return NULL */
PTD *new_ptd(str *user_name, str *raw_name, dfa *dfap);
+P_ATTR str *ptd_user_name(PTD *p);
+
/* FLAG is used to destroy the strings contained within */
void destroy_ptd(PTD *p, int flag);
@@ -134,6 +136,8 @@ find_in_cpa_list(CCR_MOD(NUM *) string, NUM size,
/* assume element is a cpa pointer */
void print_name(void *element);
+void eprint_name(void *element);
+
void print_tnt(void *element);
void print_rule(void *r);
@@ -167,9 +171,10 @@ void destroy_rule_no_free(void *rule);
void destroy_cpa_and_free_all(void *element);
void destroy_grammar(void *grammar, int flag);
-NUM grammar_left_len(CCR_MOD(Grammar *)g);
+P_ATTR NUM grammar_left_len(CCR_MOD(Grammar *)g);
-List *grammar_names(CCR_MOD(Grammar *)g);
+P_ATTR List *grammar_names(CCR_MOD(Grammar *)g);
+P_ATTR List *grammar_preds(CCR_MOD(Grammar *)g);
/* look up a rule */
Rule_group *grammar_rule(CCR_MOD(Grammar *) g, NT nt);