From acb30a24128863f2d57ac9aa20a93c8dd243b80b Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 5 Jul 2017 15:03:27 +0000 Subject: 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. --- eqn.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'eqn.c') 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 * Copyright (c) 2014, 2015, 2017 Ingo Schwarze @@ -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: -- cgit v1.2.3-56-ge451