summaryrefslogtreecommitdiffstats
path: root/mdocml.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-17 17:18:38 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-17 17:18:38 +0000
commita480b0be958ffbd581a55e07bd9bc454bff192d0 (patch)
treea7a4843315379e0a3c3e290d190bc835fde283aa /mdocml.c
parent92941d9a204a13e8a7ffd43cc025199c04152f6e (diff)
downloadmandoc-a480b0be958ffbd581a55e07bd9bc454bff192d0.tar.gz
Prologue Dd and Dt macros.
Diffstat (limited to 'mdocml.c')
-rw-r--r--mdocml.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/mdocml.c b/mdocml.c
index 20803330..f6ac8072 100644
--- a/mdocml.c
+++ b/mdocml.c
@@ -265,9 +265,9 @@ parse_begin(struct md_parse *p)
for (i = 0; i < sz; i++) {
if ('\n' != p->buf[i]) {
if (pos < sizeof(line)) {
- /* LINTED */
- sv[pos] = p->buf[i];
- line[pos++] = p->buf[i];
+ sv[(int)pos] = p->buf[(int)i];
+ line[(int)pos++] =
+ p->buf[(int)i];
continue;
}
warnx("%s: line %d too long",
@@ -306,6 +306,9 @@ msg_err(void *arg, int tok, int col, enum mdoc_err type)
case (ERR_SYNTAX_WS):
lit = "syntax: whitespace in argument";
break;
+ case (ERR_SYNTAX_ARGS):
+ fmt = "syntax: macro `%s' arguments malformed";
+ break;
case (ERR_SCOPE_BREAK):
/* Which scope is broken? */
fmt = "macro `%s' breaks prior explicit scope";
@@ -316,9 +319,27 @@ msg_err(void *arg, int tok, int col, enum mdoc_err type)
case (ERR_MACRO_NOTCALL):
fmt = "macro `%s' not callable";
break;
+ case (ERR_SEC_PROLOGUE):
+ fmt = "macro `%s' cannot be called in the prologue";
+ break;
+ case (ERR_SEC_NPROLOGUE):
+ fmt = "macro `%s' called outside of prologue";
+ break;
case (ERR_ARGS_GE1):
fmt = "macro `%s' expects one or more arguments";
break;
+ case (ERR_ARGS_MANY):
+ fmt = "macro `%s' has too many arguments";
+ break;
+ case (ERR_SEC_PROLOGUE_OO):
+ fmt = "prologue macro `%s' is out-of-order";
+ break;
+ case (ERR_SEC_PROLOGUE_REP):
+ fmt = "prologue macro `%s' repeated";
+ break;
+ case (ERR_SEC_NAME):
+ lit = "`NAME' section must be first";
+ break;
default:
abort();
/* NOTREACHED */
@@ -333,7 +354,11 @@ msg_err(void *arg, int tok, int col, enum mdoc_err type)
p->name, p->lnn, lit);
if (p->dbg < 1) {
- (void)fprintf(stderr, " (column %d)\n", col);
+ if (-1 != col)
+ (void)fprintf(stderr, " (column %d)\n", col);
+ return(0);
+ } else if (-1 == col) {
+ (void)fprintf(stderr, "\nFrom: %s", p->line);
return(0);
}
@@ -360,7 +385,11 @@ msg_msg(void *arg, int col, const char *msg)
(void)printf("%s:%d: %s", p->name, p->lnn, msg);
if (p->dbg < 3) {
- (void)printf(" (column %d)\n", col);
+ if (-1 != col)
+ (void)printf(" (column %d)\n", col);
+ return;
+ } else if (-1 == col) {
+ (void)printf("\nFrom %s\n", p->line);
return;
}
@@ -393,6 +422,9 @@ msg_warn(void *arg, int tok, int col, enum mdoc_warn type)
case (WARN_SYNTAX_MACLIKE):
lit = "syntax: macro-like argument";
break;
+ case (WARN_SEC_OO):
+ lit = "section is out of conventional order";
+ break;
case (WARN_ARGS_GE1):
fmt = "macro `%s' suggests one or more arguments";
break;