diff options
-rw-r--r-- | man.c | 7 | ||||
-rw-r--r-- | mdoc.c | 9 | ||||
-rw-r--r-- | read.c | 19 | ||||
-rw-r--r-- | roff.c | 9 |
4 files changed, 13 insertions, 31 deletions
@@ -471,13 +471,6 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) int i, ppos; int bline; - if ('"' == buf[offs]) { - mandoc_msg(MANDOCERR_COMMENT_BAD, man->parse, - ln, offs, NULL); - return(1); - } else if ('\0' == buf[offs]) - return(1); - ppos = offs; /* @@ -793,15 +793,6 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) char mac[5]; struct mdoc_node *n; - /* Empty post-control lines are ignored. */ - - if ('"' == buf[offs]) { - mandoc_msg(MANDOCERR_COMMENT_BAD, mdoc->parse, - ln, offs, NULL); - return(1); - } else if ('\0' == buf[offs]) - return(1); - sv = offs; /* @@ -69,9 +69,9 @@ struct mparse { int line; /* line number in the file */ }; +static void choose_parser(struct mparse *); static void resize_buf(struct buf *, size_t); static void mparse_buf_r(struct mparse *, struct buf, int); -static void pset(const char *, int, struct mparse *); static int read_whole_file(struct mparse *, const char *, int, struct buf *, int *); static void mparse_end(struct mparse *); @@ -247,19 +247,10 @@ resize_buf(struct buf *buf, size_t initial) } static void -pset(const char *buf, int pos, struct mparse *curp) +choose_parser(struct mparse *curp) { char *cp, *ep; int format; - int i; - - if ('.' == buf[0] || '\'' == buf[0]) { - for (i = 1; buf[i]; i++) - if (' ' != buf[i] && '\t' != buf[i]) - break; - if ('\0' == buf[i]) - return; - } /* * If neither command line arguments -mdoc or -man select @@ -550,12 +541,10 @@ rerun: */ if ( ! (curp->man || curp->mdoc)) - pset(ln.buf + of, pos - of, curp); + choose_parser(curp); /* - * Lastly, push down into the parsers themselves. One - * of these will have already been set in the pset() - * routine. + * Lastly, push down into the parsers themselves. * 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 @@ -759,6 +759,15 @@ roff_parseln(struct roff *r, int ln, char **bufp, return(roff_parsetext(bufp, szp, pos, offs)); } + /* Skip empty request lines. */ + + if ((*bufp)[pos] == '"') { + mandoc_msg(MANDOCERR_COMMENT_BAD, r->parse, + ln, pos, NULL); + return(ROFF_IGN); + } else if ((*bufp)[pos] == '\0') + return(ROFF_IGN); + /* * If a scope is open, go to the child handler for that macro, * as it may want to preprocess before doing anything with it. |