aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tree.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 23:30:39 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 23:30:39 +0000
commit1f1fa3776c03b51f845d9d9f54cbc3c980f6ead6 (patch)
tree203d6d6ad512f6d6a7d032cf8117556ef029a660 /tree.c
parent3ee412a268eff0c9e52bb141dc3289eda00a6d53 (diff)
downloadmandoc-1f1fa3776c03b51f845d9d9f54cbc3c980f6ead6.tar.gz
mandoc-1f1fa3776c03b51f845d9d9f54cbc3c980f6ead6.tar.zst
mandoc-1f1fa3776c03b51f845d9d9f54cbc3c980f6ead6.zip
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.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tree.c b/tree.c
index 3d7f9085..09ebca30 100644
--- a/tree.c
+++ b/tree.c
@@ -1,4 +1,4 @@
-/* $Id: tree.c,v 1.43 2011/07/21 15:21:13 kristaps Exp $ */
+/* $Id: tree.c,v 1.44 2011/07/21 23:30:39 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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",