-/* $Id: mdoc_validate.c,v 1.116 2010/08/29 10:30:58 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.119 2010/09/27 23:03:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
static int pre_dt(PRE_ARGS);
static int pre_it(PRE_ARGS);
static int pre_os(PRE_ARGS);
+static int pre_pp(PRE_ARGS);
static int pre_rv(PRE_ARGS);
static int pre_sh(PRE_ARGS);
static int pre_ss(PRE_ARGS);
static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL };
static v_post posts_wtext[] = { ewarn_ge1, NULL };
static v_pre pres_an[] = { pre_an, NULL };
-static v_pre pres_bd[] = { pre_display, pre_bd, NULL };
-static v_pre pres_bl[] = { pre_bl, NULL };
+static v_pre pres_bd[] = { pre_display, pre_bd, pre_pp, NULL };
+static v_pre pres_bl[] = { pre_bl, pre_pp, NULL };
static v_pre pres_d1[] = { pre_display, NULL };
static v_pre pres_dd[] = { pre_dd, NULL };
static v_pre pres_dt[] = { pre_dt, NULL };
static v_pre pres_fd[] = { NULL, NULL };
static v_pre pres_it[] = { pre_it, NULL };
static v_pre pres_os[] = { pre_os, NULL };
+static v_pre pres_pp[] = { pre_pp, NULL };
static v_pre pres_rv[] = { pre_rv, NULL };
static v_pre pres_sh[] = { pre_sh, NULL };
static v_pre pres_ss[] = { pre_ss, NULL };
{ pres_os, NULL }, /* Os */
{ pres_sh, posts_sh }, /* Sh */
{ pres_ss, posts_ss }, /* Ss */
- { NULL, posts_notext }, /* Pp */
+ { pres_pp, posts_notext }, /* Pp */
{ pres_d1, posts_wline }, /* D1 */
{ pres_d1, posts_wline }, /* Dl */
{ pres_bd, posts_bd_bk }, /* Bd */
{ NULL, NULL }, /* Dx */
{ NULL, posts_text }, /* %Q */
{ NULL, posts_notext }, /* br */
- { NULL, posts_sp }, /* sp */
+ { pres_pp, posts_sp }, /* sp */
{ NULL, posts_text1 }, /* %U */
{ NULL, NULL }, /* Ta */
};
return(1);
}
+
+
+static int
+pre_pp(PRE_ARGS)
+{
+
+ if (NULL == mdoc->last)
+ return(1);
+
+ /* Don't allow prior `Lp' or `Pp'. */
+
+ if (MDOC_Pp != mdoc->last->tok && MDOC_Lp != mdoc->last->tok)
+ return(1);
+
+ if (MDOC_Bl == n->tok && n->data.Bl->comp)
+ return(1);
+ if (MDOC_Bd == n->tok && n->data.Bd->comp)
+ return(1);
+
+ mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNPAR);
+ mdoc_node_delete(mdoc, mdoc->last);
+ return(1);
+}