From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 2f37ad5a for ; Mon, 31 Dec 2018 03:38:51 -0500 (EST) Date: Mon, 31 Dec 2018 03:38:51 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Use the new flag NODE_NOFILL in the validators, which is X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: <05f85e5e4cd019bc@fantadrom.bsd.lv> Log Message: ----------- Use the new flag NODE_NOFILL in the validators, which is sometimes simpler and always more robust. In particular, move the nesting warnings for .EX and .EE from man_state(), where they were misplaced, to the man(7) validator. Modified Files: -------------- mandoc: man.c man_validate.c mdoc_validate.c roff_validate.c Revision Data ------------- Index: man_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man_validate.c,v retrieving revision 1.144 retrieving revision 1.145 diff -Lman_validate.c -Lman_validate.c -u -p -r1.144 -r1.145 --- man_validate.c +++ man_validate.c @@ -48,6 +48,8 @@ static void check_root(CHKARGS); static void check_text(CHKARGS); static void post_AT(CHKARGS); +static void post_EE(CHKARGS); +static void post_EX(CHKARGS); static void post_IP(CHKARGS); static void post_OP(CHKARGS); static void post_SH(CHKARGS); @@ -88,8 +90,8 @@ static const v_check man_valids[MAN_MAX NULL, /* SY */ NULL, /* YS */ post_OP, /* OP */ - NULL, /* EX */ - NULL, /* EE */ + post_EX, /* EX */ + post_EE, /* EE */ post_UR, /* UR */ NULL, /* UE */ post_UR, /* MT */ @@ -206,13 +208,27 @@ check_text(CHKARGS) { char *cp, *p; - if (man->flags & ROFF_NOFILL) + if (n->flags & NODE_NOFILL) return; cp = n->string; for (p = cp; NULL != (p = strchr(p, '\t')); p++) mandoc_msg(MANDOCERR_FI_TAB, n->line, n->pos + (int)(p - cp), NULL); +} + +static void +post_EE(CHKARGS) +{ + if ((n->flags & NODE_NOFILL) == 0) + mandoc_msg(MANDOCERR_FI_SKIP, n->line, n->pos, "EE"); +} + +static void +post_EX(CHKARGS) +{ + if (n->flags & NODE_NOFILL) + mandoc_msg(MANDOCERR_NF_SKIP, n->line, n->pos, "EX"); } static void Index: man.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man.c,v retrieving revision 1.184 retrieving revision 1.185 diff -Lman.c -Lman.c -u -p -r1.184 -r1.185 --- man.c +++ man.c @@ -351,15 +351,10 @@ man_state(struct roff_man *man, struct r switch(n->tok) { case ROFF_nf: case MAN_EX: - if (man->flags & ROFF_NOFILL && (n->flags & NODE_VALID) == 0) - mandoc_msg(MANDOCERR_NF_SKIP, n->line, n->pos, "nf"); man->flags |= ROFF_NOFILL; break; case ROFF_fi: case MAN_EE: - if ( (man->flags & ROFF_NOFILL) == 0 && - ! (n->flags & NODE_VALID)) - mandoc_msg(MANDOCERR_FI_SKIP, n->line, n->pos, "fi"); man->flags &= ~ROFF_NOFILL; break; default: Index: roff_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff_validate.c,v retrieving revision 1.16 retrieving revision 1.17 diff -Lroff_validate.c -Lroff_validate.c -u -p -r1.16 -r1.17 --- roff_validate.c +++ roff_validate.c @@ -94,7 +94,7 @@ roff_valid_br(ROFF_VALID_ARGS) static void roff_valid_fi(ROFF_VALID_ARGS) { - if ((man->flags & ROFF_NOFILL) == 0) + if ((n->flags & NODE_NOFILL) == 0) mandoc_msg(MANDOCERR_FI_SKIP, n->line, n->pos, "fi"); } Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v retrieving revision 1.368 retrieving revision 1.369 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.368 -r1.369 --- mdoc_validate.c +++ mdoc_validate.c @@ -336,9 +336,7 @@ mdoc_validate(struct roff_man *mdoc) if (n->sec != SEC_SYNOPSIS || (np->tok != MDOC_Cd && np->tok != MDOC_Fd)) check_text(mdoc, n->line, n->pos, n->string); - if (np->tok != MDOC_Ql && np->tok != MDOC_Dl && - (np->tok != MDOC_Bd || - (mdoc->flags & ROFF_NOFILL) == 0) && + if ((n->flags & NODE_NOFILL) == 0 && (np->tok != MDOC_It || np->type != ROFFT_HEAD || np->parent->parent->norm->Bl.type != LIST_diag)) check_text_em(mdoc, n->line, n->pos, n->string); @@ -411,7 +409,7 @@ check_text(struct roff_man *mdoc, int ln { char *cp; - if (mdoc->flags & ROFF_NOFILL) + if (mdoc->last->flags & NODE_NOFILL) return; for (cp = p; NULL != (p = strchr(p, '\t')); p++) -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv