aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mandoc.15
-rw-r--r--mandoc.h3
-rw-r--r--read.c3
-rw-r--r--roff.c25
4 files changed, 27 insertions, 9 deletions
diff --git a/mandoc.1 b/mandoc.1
index 45a6b0cf..248a60f5 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.128 2014/12/02 11:31:51 schwarze Exp $
+.\" $Id: mandoc.1,v 1.129 2014/12/16 23:44:41 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 2 2014 $
+.Dd $Mdocdate: December 16 2014 $
.Dt MANDOC 1
.Os
.Sh NAME
@@ -1266,6 +1266,7 @@ keeps the code more readable.
.It "ignore data in cell"
.It "data block still open"
.It "ignoring extra data cells"
+.It "ignoring macro in table"
.El
.Ss "Errors related to roff, mdoc, and man code"
.Bl -ohang
diff --git a/mandoc.h b/mandoc.h
index e4cdccbc..a25163ad 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.176 2014/12/01 08:05:52 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.177 2014/12/16 23:44:41 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -144,6 +144,7 @@ enum mandocerr {
MANDOCERR_TBLIGNDATA, /* ignore data in cell */
MANDOCERR_TBLBLOCK, /* data block still open */
MANDOCERR_TBLEXTRADAT, /* ignoring extra data cells */
+ MANDOCERR_TBLMACRO, /* ignoring macro in table: macro */
/* related to document structure and macros */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
diff --git a/read.c b/read.c
index 8d6cb103..ce7b094e 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.104 2014/12/01 04:14:14 schwarze Exp $ */
+/* $Id: read.c,v 1.105 2014/12/16 23:44:41 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -188,6 +188,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"ignore data in cell",
"data block still open",
"ignoring extra data cells",
+ "ignoring macro in table",
/* related to document structure and macros */
"input stack limit exceeded, infinite loop?",
diff --git a/roff.c b/roff.c
index 099f7503..d2b2d85b 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.242 2014/12/16 03:53:43 schwarze Exp $ */
+/* $Id: roff.c,v 1.243 2014/12/16 23:44:41 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -730,6 +730,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs)
enum rofft t;
enum rofferr e;
int pos; /* parse point */
+ int spos; /* saved parse point for messages */
int ppos; /* original offset in buf->buf */
int ctl; /* macro line (boolean) */
@@ -800,15 +801,29 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs)
return((*roffs[t].sub)(r, t, buf, ln, ppos, pos, offs));
}
+ /* No scope is open. This is a new request or macro. */
+
+ spos = pos;
+ t = roff_parse(r, buf->buf, &pos, ln, ppos);
+
+ /* Tables ignore most macros. */
+
+ if (r->tbl != NULL && (t == ROFF_MAX || t == ROFF_TS)) {
+ mandoc_msg(MANDOCERR_TBLMACRO, r->parse,
+ ln, pos, buf->buf + spos);
+ return(ROFF_IGN);
+ }
+
/*
- * Lastly, as we've no scope open, try to look up and execute
- * the new macro. If no macro is found, simply return and let
- * the compilers handle it.
+ * This is neither a roff request nor a user-defined macro.
+ * Let the standard macro set parsers handle it.
*/
- if ((t = roff_parse(r, buf->buf, &pos, ln, ppos)) == ROFF_MAX)
+ if (t == ROFF_MAX)
return(ROFF_CONT);
+ /* Execute a roff request or a user defined macro. */
+
assert(roffs[t].proc);
return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs));
}