summaryrefslogtreecommitdiffstats
path: root/eqn.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 23:42:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 23:42:28 +0000
commit4a9b3b91ed883201108726196caa6825d5df0914 (patch)
tree68d9b05aed786bd75733ac40449c411a8aa9c56c /eqn.c
parent561fdaf67b6be484562a755697a834c21b10e4d9 (diff)
downloadmandoc-4a9b3b91ed883201108726196caa6825d5df0914.tar.gz
Fix eqn handling of PILE clauses (multiple ABOVE statements may be
specified for each PILE).
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/eqn.c b/eqn.c
index 4e4f4f5d..4eb3f3ca 100644
--- a/eqn.c
+++ b/eqn.c
@@ -259,33 +259,30 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last)
EQN_MSG(MANDOCERR_EQNSYNT, ep);
return(EQN_ERR);
}
- if (EQN_DESCOPE != (c = eqn_eqn(ep, last))) {
- if (EQN_ERR != c)
- EQN_MSG(MANDOCERR_EQNSCOPE, ep);
- return(EQN_ERR);
- }
- assert(last->last);
- last->last->pile = (enum eqn_pilet)i;
- eqn_rewind(ep);
- start = eqn_nexttok(ep, &sz);
- assert(start);
- if (1 == sz && 0 == strncmp("}", start, 1))
- return(EQN_OK);
- if (5 != sz || strncmp("above", start, 5)) {
- EQN_MSG(MANDOCERR_EQNSYNT, ep);
- return(EQN_ERR);
+
+ while (EQN_DESCOPE == (c = eqn_eqn(ep, last))) {
+ assert(last->last);
+ last->last->pile = (enum eqn_pilet)i;
+ eqn_rewind(ep);
+ start = eqn_nexttok(ep, &sz);
+ assert(start);
+ if (5 != sz || strncmp("above", start, 5))
+ break;
+ last->last->above = 1;
}
- last->last->above = 1;
- if (EQN_DESCOPE != (c = eqn_eqn(ep, last))) {
+
+ if (EQN_DESCOPE != c) {
if (EQN_ERR != c)
EQN_MSG(MANDOCERR_EQNSCOPE, ep);
return(EQN_ERR);
}
+
eqn_rewind(ep);
start = eqn_nexttok(ep, &sz);
assert(start);
if (1 == sz && 0 == strncmp("}", start, 1))
return(EQN_OK);
+
EQN_MSG(MANDOCERR_EQNBADSCOPE, ep);
return(EQN_ERR);
}