From 9bdc68b0e9c4ef307f52f16b3727a115cf20e060 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 12 Oct 2014 19:31:41 +0000 Subject: Improve error handling in the eqn(7) parser. Get rid of the first fatal error, MANDOCERR_EQNSYNT. In eqn(7), there is no need to be bug-compatible with groff, so there is no need to abondon the whole equation in case of a syntax error. In particular: * Skip "back", "delim", "down", "fwd", "gfont", "gsize", "left", "right", "size", and "up" without arguments. * Skip "gsize" and "size" with a non-numeric argument. * Skip closing delimiters that are not open. * Skip "above" outside piles. * For diacritic marks and binary operators without a left operand, default to an empty box. * Let piles and matrices take one argument rather than insisting on a braced list. Let HTML output handle that, too. * When rewinding, if the root box is guaranteed to match the termination condition, no error handling is needed. --- mandoc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mandoc.h') diff --git a/mandoc.h b/mandoc.h index e797f2f5..9762f8eb 100644 --- a/mandoc.h +++ b/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.161 2014/10/11 21:14:16 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.162 2014/10/12 19:31:41 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -104,6 +104,7 @@ enum mandocerr { MANDOCERR_BF_NOFONT, /* missing font type, using \fR: Bf */ MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: Bf font */ MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */ + MANDOCERR_EQN_NOBOX, /* missing eqn box, using "": op */ /* related to bad arguments */ MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */ @@ -134,7 +135,6 @@ enum mandocerr { MANDOCERR_EQNSCOPE, /* equation scope open on exit */ MANDOCERR_EQNBADSCOPE, /* overlapping equation scopes */ MANDOCERR_EQNEOF, /* unexpected end of equation */ - MANDOCERR_EQNSYNT, /* equation syntax error */ /* related to tables */ MANDOCERR_TBL, /* bad table syntax */ -- cgit v1.2.3-56-ge451