aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-07-05 15:03:27 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-07-05 15:03:27 +0000
commitacb30a24128863f2d57ac9aa20a93c8dd243b80b (patch)
tree46474fe953b663899c9a6f1594eb3c8d197277ac /eqn.c
parent7db3d6e9ae386fc036279f2166b0ececc6cd6d27 (diff)
downloadmandoc-acb30a24128863f2d57ac9aa20a93c8dd243b80b.tar.gz
mandoc-acb30a24128863f2d57ac9aa20a93c8dd243b80b.tar.zst
mandoc-acb30a24128863f2d57ac9aa20a93c8dd243b80b.zip
The EQN_LISTONE box type is pointless.
Simplify by just using EQN_LIST with expectargs = 1. Noticed while investigating a bug report from bentley@. No functional change.
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/eqn.c b/eqn.c
index 59972171..4806b933 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.72 2017/06/29 16:31:15 schwarze Exp $ */
+/* $Id: eqn.c,v 1.73 2017/07/05 15:03:27 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -729,7 +729,7 @@ next_tok:
cur->text = mandoc_strdup("");
}
parent = eqn_box_makebinary(ep, EQNPOS_NONE, parent);
- parent->type = EQN_LISTONE;
+ parent->type = EQN_LIST;
parent->expectargs = 1;
parent->font = EQNFONT_ROMAN;
switch (tok) {
@@ -782,7 +782,7 @@ next_tok:
* exactly one of those.
*/
parent = eqn_box_alloc(ep, parent);
- parent->type = EQN_LISTONE;
+ parent->type = EQN_LIST;
parent->expectargs = 1;
switch (tok) {
case EQN_TOK_FAT:
@@ -820,7 +820,7 @@ next_tok:
break;
}
parent = eqn_box_alloc(ep, parent);
- parent->type = EQN_LISTONE;
+ parent->type = EQN_LIST;
parent->expectargs = 1;
parent->size = size;
break;
@@ -908,6 +908,7 @@ next_tok:
*/
for (cur = parent; cur != NULL; cur = cur->parent)
if (cur->type == EQN_LIST &&
+ cur->expectargs > 1 &&
(tok == EQN_TOK_BRACE_CLOSE ||
cur->left != NULL))
break;
@@ -939,8 +940,9 @@ next_tok:
parent->type == EQN_MATRIX))
parent = parent->parent;
/* Close out any "singleton" lists. */
- while (parent->type == EQN_LISTONE &&
- parent->args == parent->expectargs)
+ while (parent->type == EQN_LIST &&
+ parent->expectargs == 1 &&
+ parent->args == 1)
parent = parent->parent;
break;
case EQN_TOK_BRACE_OPEN:
@@ -1100,8 +1102,9 @@ next_tok:
/*
* Post-process list status.
*/
- while (parent->type == EQN_LISTONE &&
- parent->args == parent->expectargs)
+ while (parent->type == EQN_LIST &&
+ parent->expectargs == 1 &&
+ parent->args == 1)
parent = parent->parent;
break;
default: