summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-29 19:25:29 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-29 19:25:29 +0000
commit38b49bee113edcc4afc7b96453d5f3eb3ef7b965 (patch)
treedc7d400651ec5877058b59ae50ba1718f876eabe
parentf6c6b91bd1d5c314c866ec4cb71f4ff2573fc2f2 (diff)
downloadmandoc-38b49bee113edcc4afc7b96453d5f3eb3ef7b965.tar.gz
*** empty log message ***
-rw-r--r--macro.c16
-rw-r--r--mdoc.c8
-rw-r--r--mdoc.h1
-rw-r--r--mdocml.c3
4 files changed, 24 insertions, 4 deletions
diff --git a/macro.c b/macro.c
index 02cf985c..d2e5d30f 100644
--- a/macro.c
+++ b/macro.c
@@ -219,6 +219,18 @@ append_const(struct mdoc *mdoc, int tok,
mdoc_word_alloc(mdoc, pos, args[1]);
return(1);
+ case (MDOC_Nd):
+ if (sz > 0)
+ break;
+ if ( ! mdoc_warn(mdoc, tok, pos, WARN_ARGS_GE1))
+ return(0);
+ break;
+
+ case (MDOC_Hf):
+ if (1 == sz)
+ break;
+ return(mdoc_err(mdoc, tok, pos, ERR_ARGS_EQ1));
+
case (MDOC_Bx):
/* FALLTHROUGH */
case (MDOC_Bsx):
@@ -307,6 +319,10 @@ append_text(struct mdoc *mdoc, int tok,
/* FALLTHROUGH */
case (MDOC_Ic):
/* FALLTHROUGH */
+ case (MDOC_Sy):
+ /* FALLTHROUGH */
+ case (MDOC_Sx):
+ /* FALLTHROUGH */
case (MDOC_Va):
/* FALLTHROUGH */
case (MDOC_Vt):
diff --git a/mdoc.c b/mdoc.c
index 13f46eae..1998c694 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -114,7 +114,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ macro_text, MDOC_CALLABLE }, /* Ic */
{ NULL, 0 }, /* In */
{ macro_text, MDOC_CALLABLE }, /* Li */
- { NULL, 0 }, /* Nd */
+ { macro_constant, 0 }, /* Nd */
{ NULL, 0 }, /* Nm */
{ NULL, 0 }, /* Op */
{ NULL, 0 }, /* Ot */
@@ -173,8 +173,8 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ NULL, 0 }, /* So */
{ macro_scoped_pline, MDOC_CALLABLE }, /* Sq */
{ NULL, 0 }, /* Sm */
- { NULL, 0 }, /* Sx */
- { NULL, 0 }, /* Sy */
+ { macro_text, MDOC_CALLABLE }, /* Sx */
+ { macro_text, MDOC_CALLABLE }, /* Sy */
{ macro_text, MDOC_CALLABLE }, /* Tn */
{ macro_constant_delimited, 0 }, /* Ux */
{ NULL, 0 }, /* Xc */
@@ -186,7 +186,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ NULL, 0 }, /* Bk */
{ NULL, 0 }, /* Ek */
{ macro_constant, 0 }, /* Bt */
- { NULL, 0 }, /* Hf */
+ { macro_constant, 0 }, /* Hf */
{ NULL, 0 }, /* Fr */
{ macro_constant, 0 }, /* Ud */
};
diff --git a/mdoc.h b/mdoc.h
index d327caa8..e54c6056 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -212,6 +212,7 @@ enum mdoc_err {
ERR_SEC_PROLOGUE_REP,
ERR_SEC_NAME,
ERR_ARGS_EQ0,
+ ERR_ARGS_EQ1,
ERR_ARGS_GE1,
ERR_ARGS_LE2,
ERR_ARGS_MANY
diff --git a/mdocml.c b/mdocml.c
index aff3bb3c..df8094ca 100644
--- a/mdocml.c
+++ b/mdocml.c
@@ -370,6 +370,9 @@ msg_err(void *arg, int tok, int col, enum mdoc_err type)
case (ERR_ARGS_EQ0):
fmt = "macro `%s' expects zero arguments";
break;
+ case (ERR_ARGS_EQ1):
+ fmt = "macro `%s' expects one argument";
+ break;
case (ERR_ARGS_GE1):
fmt = "macro `%s' expects one or more arguments";
break;