source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: improve diagnostics regarding arguments of .An .Pp .Lp .br .sp
Date: Wed, 4 Feb 2015 14:20:43 -0500 (EST)	[thread overview]
Message-ID: <1136965387276147575.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
improve diagnostics regarding arguments of .An .Pp .Lp .br .sp 
in particular, get rid of check_count(..., CHECK_EQ, 0)

Modified Files:
--------------
    mdocml:
        mandoc.1
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.268
retrieving revision 1.269
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.268 -r1.269
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -1174,14 +1174,15 @@ post_at(POST_ARGS)
 static void
 post_an(POST_ARGS)
 {
-	struct mdoc_node *np;
+	struct mdoc_node *np, *nch;
 
 	np = mdoc->last;
 	if (AUTH__NONE == np->norm->An.auth) {
 		if (0 == np->child)
 			check_count(mdoc, MDOC_ELEM, CHECK_GT, 0);
-	} else if (np->child)
-		check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
+	} else if ((nch = np->child) != NULL)
+		mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+		    nch->line, nch->pos, "An ... %s", nch->string);
 }
 
 static void
@@ -2134,14 +2135,17 @@ post_par(POST_ARGS)
 {
 	struct mdoc_node *np;
 
-	if (mdoc->last->tok == MDOC_sp)
-		check_count(mdoc, MDOC_ELEM, CHECK_LT, 2);
-	else
-		check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
+	np = mdoc->last;
 
-	if (MDOC_ELEM != mdoc->last->type &&
-	    MDOC_BLOCK != mdoc->last->type)
-		return;
+	if (np->tok == MDOC_sp) {
+		if (np->nchild > 1)
+			mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+			    np->child->next->line, np->child->next->pos,
+			    "sp ... %s", np->child->next->string);
+	} else if (np->child != NULL)
+		mandoc_vmsg(MANDOCERR_ARG_SKIP,
+		    mdoc->parse, np->line, np->pos, "%s %s",
+		    mdoc_macronames[np->tok], np->child->string);
 
 	if (NULL == (np = mdoc->last->prev)) {
 		np = mdoc->last->parent;
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.143
retrieving revision 1.144
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.143 -r1.144
--- mandoc.1
+++ mandoc.1
@@ -1602,6 +1602,8 @@ An
 .Ic \&Ef ,
 .Ic \&Ek ,
 .Ic \&El ,
+.Ic \&Lp ,
+.Ic \&Pp ,
 .Ic \&Re ,
 .Ic \&Rs ,
 or
@@ -1621,14 +1623,24 @@ or
 .Ic \&EN
 macro, or a
 .Xr roff 7
+.Ic \&br
+request or
 .Sq \&..
 block closing request is invoked with at least one argument.
 All arguments are ignored.
 .It Sy "skipping excess arguments"
 .Pq mdoc , man , roff
 The
+.Ic \&An
+macro is invoked with another argument after
+.Fl split
+or
+.Fl nosplit ,
+the
 .Ic \&Bf
-macro is invoked with more than one argument, the
+macro or the
+.Ic \&sp
+request is invoked with more than one argument, the
 .Ic \&RE
 macro is invoked with more than one argument
 or with a non-integer argument, or a request of the
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2015-02-04 19:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1136965387276147575.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).