summaryrefslogtreecommitdiff
path: root/src/grammar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/grammar.c')
-rw-r--r--src/grammar.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/grammar.c b/src/grammar.c
index 4052510..508c8d8 100644
--- a/src/grammar.c
+++ b/src/grammar.c
@@ -104,14 +104,14 @@ new_tnt(int type, ...)
}
Rule *
-new_rule(NT left, List *right)
+new_rule(NT left, const List * const right)
{
if (!right) return NULL;
Rule *rule = MYALLOC(Rule, 1);
rule->left = left;
- rule->right = right;
+ rule->right = (List *) right;
return rule;
}
@@ -124,10 +124,10 @@ new_grammar()
}
/* We classify the rules into different rule groups. */
-unsigned char
-build_grammar(Grammar *g, List *rules, List *names)
+BOOL
+build_grammar(Grammar *g, const List *rules, const List * const names)
{
- g->names = names;
+ g->names = (List *) names;
NUM len = list_length(names);
NUM rule_len = list_length(rules);
@@ -246,11 +246,12 @@ print_rule(void *r)
}
NUM
-find_in_cpa_list(NUM *string, NUM size, List *list)
+find_in_cpa_list(const NUM * const restrict string, NUM size,
+ const List * const restrict list)
{
NUM len = list_length(list), index = 0;
- unsigned char foundp = 0;
+ BOOL foundp = 0;
for (; !foundp && index < len;) {
cpa *cpap = list_nth(list, index);
@@ -304,7 +305,7 @@ print_name(void *element)
/* REVIEW: Print the names of non-terminals out, instead of printing
the numbers? */
void
-print_grammar(Grammar *g)
+print_grammar(const Grammar * const g)
{
printf("Printing a grammar:\n");
map_list_between(g->names, print_name, print_sep);