-/* $Id: mdoc.c,v 1.129 2010/05/12 17:08:03 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.133 2010/05/15 16:24:37 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
"prologue macro out of conventional order", /* EPROLOOO */
"prologue macro repeated", /* EPROLREP */
"invalid manual section", /* EBADMSEC */
- "invalid section", /* EBADSEC */
"invalid font mode", /* EFONT */
"invalid date syntax", /* EBADDATE */
"invalid number format", /* ENUMFMT */
free(mdoc->meta.arch);
if (mdoc->meta.vol)
free(mdoc->meta.vol);
+ if (mdoc->meta.msec)
+ free(mdoc->meta.msec);
}
if (MDOC_HALT & m->flags)
return(0);
- return('.' == *buf ? mdoc_pmacro(m, ln, buf) :
+ m->flags |= MDOC_NEWLINE;
+ return('.' == *buf ?
+ mdoc_pmacro(m, ln, buf) :
mdoc_ptext(m, ln, buf));
}
p->pos = pos;
p->tok = tok;
p->type = type;
-
+ if (MDOC_NEWLINE & m->flags)
+ p->flags |= MDOC_LINE;
+ m->flags &= ~MDOC_NEWLINE;
return(p);
}
* sentence. The front-end will know how to interpret this.
*/
+ /* FIXME: chain of close delims. */
+
assert(i);
if (mandoc_eos(buf, (size_t)i))
mdoc_pmacro(struct mdoc *m, int ln, char *buf)
{
enum mdoct tok;
- int i, j;
+ int i, j, sv;
char mac[5];
/* Empty lines are ignored. */
return(1);
}
+ sv = i;
+
/* Copy the first word into a nil-terminated buffer. */
for (j = 0; j < 4; j++, i++) {
* Begin recursive parse sequence. Since we're at the start of
* the line, we don't need to do callable/parseable checks.
*/
- if ( ! mdoc_macro(m, tok, ln, 1, &i, buf))
+ if ( ! mdoc_macro(m, tok, ln, sv, &i, buf))
goto err;
return(1);