From 561fdaf67b6be484562a755697a834c21b10e4d9 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 21 Jul 2011 23:30:39 +0000 Subject: Complete eqn.7 parsing. Features all productions from the original 1975 CACM paper in an LR(1) parse (1 -> eqn_rewind()). Right now the code is a little jungly, but will clear up as I consolidate parse components. The AST structure will also be cleaned up, as right now it's pretty ad hoc (this won't change the parse itself). I added the mandoc_strndup() function will here. --- tree.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tree.c') diff --git a/tree.c b/tree.c index c1d7937e..96ca7eb3 100644 --- a/tree.c +++ b/tree.c @@ -274,13 +274,16 @@ print_box(const struct eqn_box *ep, int indent) printf("eqn-root(%d, %d, %d, %d)\n", EQN_DEFSIZE == ep->size ? 0 : ep->size, ep->pos, ep->font, ep->mark); - print_box(ep->child, indent + 1); + print_box(ep->first, indent + 1); break; case (EQN_SUBEXPR): - printf("eqn-subxpr(%d, %d, %d, %d)\n", + printf("eqn-subxpr(%d, %d, %d, %d, %d, %d, \"%s\", \"%s\")\n", EQN_DEFSIZE == ep->size ? 0 : ep->size, - ep->pos, ep->font, ep->mark); - print_box(ep->child, indent + 1); + ep->pos, ep->font, ep->mark, + ep->pile, ep->above, + ep->left ? ep->left : "", + ep->right ? ep->right : ""); + print_box(ep->first, indent + 1); break; case (EQN_TEXT): printf("eqn-text(%d, %d, %d, %d): [%s]\n", -- cgit