aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-01 13:37:40 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-01 13:37:40 +0000
commit2b66c5c132641d27e718a7a8d4b01c9dce9e1ac8 (patch)
tree9102800579aa25c39ce8eb687ce3dddb4f3ec78b
parentc80b8c034f0e42db26a04a17527b0b7e3dc6512b (diff)
downloadmandoc-2b66c5c132641d27e718a7a8d4b01c9dce9e1ac8.tar.gz
mandoc-2b66c5c132641d27e718a7a8d4b01c9dce9e1ac8.tar.zst
mandoc-2b66c5c132641d27e718a7a8d4b01c9dce9e1ac8.zip
Switch on tbl rows being added to the parse stream. Here we go!
-rw-r--r--main.c17
-rw-r--r--tbl.c10
-rw-r--r--tbl_data.c4
3 files changed, 21 insertions, 10 deletions
diff --git a/main.c b/main.c
index 5e5080cc..595a0a2b 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.127 2010/12/29 14:38:14 kristaps Exp $ */
+/* $Id: main.c,v 1.128 2011/01/01 13:37:40 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -798,7 +798,7 @@ rerun:
continue;
} else
break;
- case (ROFF_CONT):
+ default:
break;
}
@@ -816,9 +816,20 @@ rerun:
* Lastly, push down into the parsers themselves. One
* of these will have already been set in the pset()
* routine.
+ * If libroff returns ROFF_TBL, then add it to the
+ * currently open parse. Since we only get here if
+ * there does exist data (see tbl_data.c), we're
+ * guaranteed that something's been allocated.
*/
- if (curp->man || curp->mdoc) {
+ if (ROFF_TBL == rr) {
+ assert(curp->man || curp->mdoc);
+ if (curp->man)
+ man_addspan(curp->man, roff_span(curp->roff));
+ else
+ mdoc_addspan(curp->mdoc, roff_span(curp->roff));
+
+ } else if (curp->man || curp->mdoc) {
rc = curp->man ?
man_parseln(curp->man,
curp->line, ln.buf, of) :
diff --git a/tbl.c b/tbl.c
index 7b5e299c..65e1d87e 100644
--- a/tbl.c
+++ b/tbl.c
@@ -1,4 +1,4 @@
-/* $Id: tbl.c,v 1.11 2010/12/31 18:19:43 kristaps Exp $ */
+/* $Id: tbl.c,v 1.12 2011/01/01 13:37:40 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -56,11 +56,11 @@ tbl_read(struct tbl *tbl, int ln, const char *p, int offs)
break;
}
- /*
- * FIXME: allow the original string to slip through for the time
- * being.
+ /*
+ * This only returns zero if the line is empty, so we ignore it
+ * and continue on.
*/
- return(tbl_data(tbl, ln, p) ? ROFF_CONT : ROFF_ERR);
+ return(tbl_data(tbl, ln, p) ? ROFF_TBL : ROFF_IGN);
}
struct tbl *
diff --git a/tbl_data.c b/tbl_data.c
index a86cd295..b04d8046 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.3 2010/12/30 10:26:00 kristaps Exp $ */
+/* $Id: tbl_data.c,v 1.4 2011/01/01 13:37:40 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -91,7 +91,7 @@ tbl_data(struct tbl *tbl, int ln, const char *p)
if ('\0' == p[pos]) {
TBL_MSG(tbl, MANDOCERR_TBL, ln, pos);
- return(1);
+ return(0);
}
/*