-/* $OpenBSD: eqn.c,v 1.32 2017/06/23 21:04:34 schwarze Exp $ */
+/* $OpenBSD: eqn.c,v 1.33 2017/06/26 11:04:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
eqn_parse(struct eqn_node *ep, struct eqn_box *parent)
{
char sym[64];
- struct eqn_box *cur, *nbox;
+ struct eqn_box *cur, *nbox, *split;
const char *cp, *cpn, *start;
char *p;
size_t sz;
break;
cpn = p - 1;
ccln = CCL_LET;
+ split = NULL;
for (;;) {
/* Advance to next character. */
cp = cpn++;
parent->last = cur->prev;
parent->args--;
/* Set up a list instead. */
- nbox = eqn_box_alloc(ep, parent);
- nbox->type = EQN_LIST;
+ split = eqn_box_alloc(ep, parent);
+ split->type = EQN_LIST;
/* Insert the word into the list. */
- nbox->first = nbox->last = cur;
- cur->parent = nbox;
+ split->first = split->last = cur;
+ cur->parent = split;
cur->prev = NULL;
- parent = nbox;
+ parent = split;
}
/* Append a new text box. */
nbox = eqn_box_alloc(ep, parent);
cpn = p - 1;
ccln = CCL_LET;
}
+ if (split != NULL)
+ parent = split->parent;
break;
}
/*