-# $OpenBSD: Makefile,v 1.4 2014/10/13 23:31:26 schwarze Exp $
+# $OpenBSD: Makefile,v 1.5 2014/12/16 23:44:16 schwarze Exp $
-REGRESS_TARGETS = center fonts numbers span vert
-SKIP_TMAN ?= ALL
+REGRESS_TARGETS = center fonts macro nested numbers span vert
+LINT_TARGETS = macro nested
+SKIP_GROFF = nested
+SKIP_TMAN ?= ALL
TBL = /usr/local/bin/tbl
--- /dev/null
+.TH TBL-MACRO 1 "December 16, 2014"
+.SH NAME
+tbl-macro \- macro in a table
+.SH DESCRIPTION
+normal text
+.TS
+box tab(:);
+l | l .
+a:b
+_
+.PD 1
+c:d
+.TE
+.PP
+normal text
--- /dev/null
+TBL-MACRO(1) General Commands Manual TBL-MACRO(1)
+
+
+
+N\bNA\bAM\bME\bE
+ tbl-macro - macro in a table
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ normal text
+
+ +--+---+
+ |a | b |
+ +--+---+
+ |c | d |
+ +--+---+
+ normal text
+
+
+
+ December 16, 2014 TBL-MACRO(1)
--- /dev/null
+mandoc: macro.in:11:2: ERROR: ignoring macro in table: PD 1
--- /dev/null
+.TH TBL-NESTED 1 "December 16, 2014"
+.SH NAME
+tbl-nested \- nested table
+.SH DESCRIPTION
+normal text
+.TS
+box tab(:);
+l | l .
+a:b
+_
+c:d
+.TS
+e:f
+.TE
+.PP
+normal text
--- /dev/null
+TBL-NESTED(1) General Commands Manual TBL-NESTED(1)
+
+
+
+N\bNA\bAM\bME\bE
+ tbl-nested - nested table
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ normal text
+
+ +--+---+
+ |a | b |
+ +--+---+
+ |c | d |
+ |e | f |
+ +--+---+
+ normal text
+
+
+
+ December 16, 2014 TBL-NESTED(1)
--- /dev/null
+mandoc: nested.in:12:4: ERROR: ignoring macro in table: TS
-/* $OpenBSD: mandoc.h,v 1.118 2014/12/01 08:05:02 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.119 2014/12/16 23:44:16 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
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? */
-/* $OpenBSD: read.c,v 1.79 2014/11/30 05:28:00 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.80 2014/12/16 23:44:16 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
"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?",
-/* $OpenBSD: roff.c,v 1.114 2014/12/16 03:52:31 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.115 2014/12/16 23:44:16 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
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) */
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));
}