[BACK]Return to mdoc_validate.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/mdoc_validate.c between version 1.109 and 1.114

version 1.109, 2010/07/04 21:59:30 version 1.114, 2010/07/26 13:45:49
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 32 
Line 32 
 #include "libmandoc.h"  #include "libmandoc.h"
   
 /* FIXME: .Bl -diag can't have non-text children in HEAD. */  /* FIXME: .Bl -diag can't have non-text children in HEAD. */
 /* TODO: ignoring Pp (it's superfluous in some invocations). */  
   
 #define PRE_ARGS  struct mdoc *mdoc, struct mdoc_node *n  #define PRE_ARGS  struct mdoc *mdoc, struct mdoc_node *n
 #define POST_ARGS struct mdoc *mdoc  #define POST_ARGS struct mdoc *mdoc
Line 146  static v_pre  pres_ss[] = { pre_ss, NULL };
Line 145  static v_pre  pres_ss[] = { pre_ss, NULL };
   
 const   struct valids mdoc_valids[MDOC_MAX] = {  const   struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, NULL },                         /* Ap */          { NULL, NULL },                         /* Ap */
         { pres_dd, posts_text },                /* Dd */          { pres_dd, posts_wtext },               /* Dd */
         { pres_dt, posts_dt },                  /* Dt */          { pres_dt, posts_dt },                  /* Dt */
         { pres_os, NULL },                      /* Os */          { pres_os, NULL },                      /* Os */
         { pres_sh, posts_sh },                  /* Sh */          { pres_sh, posts_sh },                  /* Sh */
Line 454  check_argv(struct mdoc *m, struct mdoc_node *n, struct
Line 453  check_argv(struct mdoc *m, struct mdoc_node *n, struct
   
   
 static int  static int
 check_text(struct mdoc *mdoc, int line, int pos, char *p)  check_text(struct mdoc *m, int ln, int pos, char *p)
 {  {
         int              c;          int              c;
           size_t           sz;
   
         /*  
          * FIXME: we absolutely cannot let \b get through or it will  
          * destroy some assumptions in terms of format.  
          */  
   
         for ( ; *p; p++, pos++) {          for ( ; *p; p++, pos++) {
                   sz = strcspn(p, "\t\\");
                   p += (int)sz;
   
                   if ('\0' == *p)
                           break;
   
                   pos += (int)sz;
   
                 if ('\t' == *p) {                  if ('\t' == *p) {
                         if ( ! (MDOC_LITERAL & mdoc->flags))                          if (MDOC_LITERAL & m->flags)
                                 if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR))                                  continue;
                                         return(0);                          if (mdoc_pmsg(m, ln, pos, MANDOCERR_BADTAB))
                 } else if ( ! isprint((u_char)*p) && ASCII_HYPH != *p)                                  continue;
                         if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR))                          return(0);
                                 return(0);                  }
   
                 if ('\\' != *p)                  /* Check the special character. */
                         continue;  
   
                 c = mandoc_special(p);                  c = mandoc_special(p);
                 if (c) {                  if (c) {
Line 482  check_text(struct mdoc *mdoc, int line, int pos, char 
Line 484  check_text(struct mdoc *mdoc, int line, int pos, char 
                         continue;                          continue;
                 }                  }
   
                 c = mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADESCAPE);                  c = mdoc_pmsg(m, ln, pos, MANDOCERR_BADESCAPE);
                 if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags) && ! c)                  if ( ! (MDOC_IGN_ESCAPE & m->pflags) && ! c)
                         return(c);                          return(c);
         }          }
   
Line 491  check_text(struct mdoc *mdoc, int line, int pos, char 
Line 493  check_text(struct mdoc *mdoc, int line, int pos, char 
 }  }
   
   
   
   
 static int  static int
 check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t)  check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t)
 {  {
Line 510  check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type 
Line 510  check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type 
 }  }
   
   
   
 static int  static int
 pre_display(PRE_ARGS)  pre_display(PRE_ARGS)
 {  {
Line 625  pre_bl(PRE_ARGS)
Line 624  pre_bl(PRE_ARGS)
                         if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV))                          if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV))
                                 return(0);                                  return(0);
                         break;                          break;
                   default:
                           continue;
                 }                  }
   
                 /* Check: duplicate auxiliary arguments. */                  /* Check: duplicate auxiliary arguments. */
Line 947  static int
Line 948  static int
 post_bf(POST_ARGS)  post_bf(POST_ARGS)
 {  {
         struct mdoc_node *np;          struct mdoc_node *np;
         int               arg;          enum mdocargt     arg;
   
         /*          /*
          * Unlike other data pointers, these are "housed" by the HEAD           * Unlike other data pointers, these are "housed" by the HEAD

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.114

CVSweb