diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-07 15:53:00 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-07 15:53:00 +0000 |
commit | a7a1dadb16951c8d91f80da5763dd5c3cb973ffa (patch) | |
tree | a2fad109014a0019d86fee2a8da0ac095041cbc3 /mdoc.c | |
parent | b7ba0decc3a3349611b6f43d72d947e89d4c2d67 (diff) | |
download | mandoc-a7a1dadb16951c8d91f80da5763dd5c3cb973ffa.tar.gz |
*** empty log message ***
Diffstat (limited to 'mdoc.c')
-rw-r--r-- | mdoc.c | 40 |
1 files changed, 35 insertions, 5 deletions
@@ -249,11 +249,32 @@ mdoc_alloc(void *data, const struct mdoc_cb *cb) int -mdoc_parseln(struct mdoc *mdoc, char *buf) +mdoc_endparse(struct mdoc *mdoc) +{ + + if (MDOC_HALT & mdoc->flags) + return(0); + if (NULL == mdoc->first) + return(1); + + assert(mdoc->last); + if ( ! macro_end(mdoc)) { + mdoc->flags |= MDOC_HALT; + return(0); + } + return(1); +} + + +int +mdoc_parseln(struct mdoc *mdoc, int line, char *buf) { int c, i; char tmp[5]; + if (MDOC_HALT & mdoc->flags) + return(0); + if ('.' != *buf) { if (SEC_PROLOGUE == mdoc->sec_lastn) return(mdoc_err(mdoc, -1, 0, ERR_SYNTAX_NOTEXT)); @@ -270,23 +291,32 @@ mdoc_parseln(struct mdoc *mdoc, char *buf) while (buf[i] && ! isspace(buf[i]) && i < (int)sizeof(tmp)) i++; - if (i == (int)sizeof(tmp)) + if (i == (int)sizeof(tmp)) { + mdoc->flags |= MDOC_HALT; return(mdoc_err(mdoc, -1, 1, ERR_MACRO_NOTSUP)); - else if (i <= 2) + } else if (i <= 2) { + mdoc->flags |= MDOC_HALT; return(mdoc_err(mdoc, -1, 1, ERR_MACRO_NOTSUP)); + } i--; (void)memcpy(tmp, buf + 1, (size_t)i); tmp[i++] = 0; - if (MDOC_MAX == (c = mdoc_find(mdoc, tmp))) + if (MDOC_MAX == (c = mdoc_find(mdoc, tmp))) { + mdoc->flags |= MDOC_HALT; return(mdoc_err(mdoc, c, 1, ERR_MACRO_NOTSUP)); + } while (buf[i] && isspace(buf[i])) i++; - return(mdoc_macro(mdoc, c, 1, &i, buf)); + if ( ! mdoc_macro(mdoc, c, 1, &i, buf)) { + mdoc->flags |= MDOC_HALT; + return(0); + } + return(1); } |