source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: better error reporting for .br .fi .nf with arguments
Date: Fri, 6 Feb 2015 03:29:05 -0500 (EST)	[thread overview]
Message-ID: <1640944764047188510.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
better error reporting for .br .fi .nf with arguments

Modified Files:
--------------
    mdocml:
        man_macro.c
        man_validate.c
        mandoc.1

Revision Data
-------------
Index: man_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_macro.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -Lman_macro.c -Lman_macro.c -u -p -r1.95 -r1.96
--- man_macro.c
+++ man_macro.c
@@ -420,6 +420,13 @@ in_line_eoln(MACRO_PROT_ARGS)
 	n = man->last;
 
 	for (;;) {
+		if (buf[*pos] != '\0' && (tok == MAN_br ||
+		    tok == MAN_fi || tok == MAN_nf)) {
+			mandoc_vmsg(MANDOCERR_ARG_SKIP,
+			    man->parse, line, *pos, "%s %s",
+			    man_macronames[tok], buf + *pos);
+			break;
+		}
 		la = *pos;
 		if ( ! man_args(man, line, pos, buf, &p))
 			break;
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.147
retrieving revision 1.148
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.147 -r1.148
--- mandoc.1
+++ mandoc.1
@@ -1635,7 +1635,10 @@ or
 .Ic \&EN
 macro, or a
 .Xr roff 7
-.Ic \&br
+.Ic \&br ,
+.Ic \&fi ,
+or
+.Ic \&nf
 request or
 .Sq \&..
 block closing request is invoked with at least one argument.
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_validate.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -Lman_validate.c -Lman_validate.c -u -p -r1.110 -r1.111
--- man_validate.c
+++ man_validate.c
@@ -38,7 +38,6 @@
 
 typedef	void	(*v_check)(CHKARGS);
 
-static	void	  check_eq0(CHKARGS);
 static	void	  check_eq2(CHKARGS);
 static	void	  check_le1(CHKARGS);
 static	void	  check_le5(CHKARGS);
@@ -182,7 +181,6 @@ check_##name(CHKARGS) \
 	    #ineq, (x), n->nchild); \
 }
 
-INEQ_DEFINE(0, ==, eq0)
 INEQ_DEFINE(2, ==, eq2)
 INEQ_DEFINE(1, <=, le1)
 INEQ_DEFINE(5, <=, le5)
@@ -401,9 +399,7 @@ static void
 post_nf(CHKARGS)
 {
 
-	check_eq0(man, n);
-
-	if (MAN_LITERAL & man->flags)
+	if (man->flags & MAN_LITERAL)
 		mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
 		    n->line, n->pos, "nf");
 
@@ -414,8 +410,6 @@ static void
 post_fi(CHKARGS)
 {
 
-	check_eq0(man, n);
-
 	if ( ! (MAN_LITERAL & man->flags))
 		mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
 		    n->line, n->pos, "fi");
@@ -501,9 +495,7 @@ static void
 post_vs(CHKARGS)
 {
 
-	if (n->tok == MAN_br)
-		check_eq0(man, n);
-	else
+	if (n->tok == MAN_sp)
 		check_le1(man, n);
 
 	if (NULL != n->prev)
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2015-02-06  8:29 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=1640944764047188510.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).