summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmdoc.h1
-rw-r--r--mdoc.c1
-rw-r--r--mdoc_validate.c20
3 files changed, 16 insertions, 6 deletions
diff --git a/libmdoc.h b/libmdoc.h
index 291d6dc0..5b1d51fa 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -93,6 +93,7 @@ enum merr {
ENOCTX,
ELIB,
EBADCHILD,
+ ENOTYPE,
MERRMAX
};
diff --git a/mdoc.c b/mdoc.c
index 103cd965..1f7ca31f 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -78,6 +78,7 @@ const char *const __mdoc_merrnames[MERRMAX] = {
"closure macro without prior context", /* ENOCTX */
"no description found for library", /* ELIB */
"bad child for parent context", /* EBADCHILD */
+ "list arguments preceding type", /* ENOTYPE */
};
const char *const __mdoc_macronames[MDOC_MAX] = {
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 83add494..ee373de3 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -621,25 +621,33 @@ pre_bl(PRE_ARGS)
case (MDOC_Inset):
/* FALLTHROUGH */
case (MDOC_Column):
- if (-1 != type)
+ if (type >= 0)
return(mdoc_nerr(mdoc, n, EMULTILIST));
type = n->args->argv[pos].arg;
break;
+ case (MDOC_Compact):
+ if (type < 0 && ! mdoc_nwarn(mdoc, n, ENOTYPE))
+ return(0);
+ break;
case (MDOC_Width):
- if (-1 != width)
+ if (width >= 0)
return(mdoc_nerr(mdoc, n, EARGREP));
+ if (type < 0 && ! mdoc_nwarn(mdoc, n, ENOTYPE))
+ return(0);
width = n->args->argv[pos].arg;
break;
case (MDOC_Offset):
- if (-1 != offset)
+ if (offset >= 0)
return(mdoc_nerr(mdoc, n, EARGREP));
+ if (type < 0 && ! mdoc_nwarn(mdoc, n, ENOTYPE))
+ return(0);
offset = n->args->argv[pos].arg;
break;
default:
break;
}
- if (-1 == type)
+ if (type < 0)
return(mdoc_nerr(mdoc, n, ELISTTYPE));
/*
@@ -650,7 +658,7 @@ pre_bl(PRE_ARGS)
switch (type) {
case (MDOC_Tag):
- if (-1 == width && ! mdoc_nwarn(mdoc, n, EMISSWIDTH))
+ if (width < 0 && ! mdoc_nwarn(mdoc, n, EMISSWIDTH))
return(0);
break;
case (MDOC_Column):
@@ -660,7 +668,7 @@ pre_bl(PRE_ARGS)
case (MDOC_Inset):
/* FALLTHROUGH */
case (MDOC_Item):
- if (-1 != width && ! mdoc_nwarn(mdoc, n, ENOWIDTH))
+ if (width >= 0 && ! mdoc_nwarn(mdoc, n, ENOWIDTH))
return(0);
break;
default: