summaryrefslogtreecommitdiff
path: root/src/bsr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bsr.c')
-rw-r--r--src/bsr.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/src/bsr.c b/src/bsr.c
index 4b7953a..2736a1b 100644
--- a/src/bsr.c
+++ b/src/bsr.c
@@ -242,8 +242,60 @@ print_bsr_f(pair5 label)
print_name(list_nth(grammar_names(bsr_print_grammar),
label.x));
printf(" := ");
+ /* List *string = rg_nth(grammar_rule(bsr_print_grammar, label.x),
+ * label.u);
+ *
+ * char s[5];
+ * str *strp = (str *) new_utf8(s, 5);
+ *
+ * for (NUM i = 0; i < list_length(string); i++) {
+ * TNT *tntp = (TNT *)list_nth(string, i);
+ * PTD *ptdp = NULL;
+ * switch (tntp->type) {
+ * case TERMINAL:
+ * printf("'");
+ * if (encode
+ * (tntp->data.t, strp)) {
+ * destroy_str(strp, 0);
+ * fleprintf0("Fail to encode\n");
+ * return;
+ * }
+ * printf("%s'", s);
+ * str_set_length(strp, 5);
+ * break;
+ * case NONTERMINAL:
+ * for (int k = 0;
+ * (UNUM) k <
+ * ((cpa *) list_nth(grammar_names(bsr_print_grammar),
+ * tntp->data.nt))->size;
+ * k++) {
+ * if (encode
+ * (*(((cpa *)list_nth
+ * (grammar_names(bsr_print_grammar),
+ * tntp->data.nt))->array+k),
+ * strp)) {
+ * destroy_str(strp, 0);
+ * fleprintf0("Fail to encode!\n");
+ * return;
+ * }
+ * printf("%s", s);
+ * str_set_length(strp, 5);
+ * }
+ * break;
+ * default:
+ * ptdp = (PTD *) list_nth
+ * (grammar_preds(bsr_print_grammar), tntp->data.pt);
+ * printf("[%s]", get_data(ptd_user_name(ptdp)));
+ * break;
+ * }
+ * if (i+1<list_length(string)) printf(", ");
+ * else printf(",\n");
+ * }
+ *
+ * destroy_str(strp, 0); */
+
map_list_between
- (rg_nth (grammar_rule(bsr_print_grammar, label.x), label.u),
+ (rg_nth(grammar_rule(bsr_print_grammar, label.x), label.u),
print_tnt, print_sep);
printf(", %ld, %ld, %ld)", label.y, label.v, label.z);