[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.12 and 1.14

version 1.12, 2009/06/17 10:53:32 version 1.14, 2009/06/17 14:08:47
Line 46  enum merr {
Line 46  enum merr {
         EMULTILIST,          EMULTILIST,
         EARGREP,          EARGREP,
         EBOOL,          EBOOL,
           ECOLMIS,
         ENESTDISP          ENESTDISP
 };  };
   
Line 138  static int post_args(POST_ARGS);
Line 139  static int post_args(POST_ARGS);
 static  int     post_at(POST_ARGS);  static  int     post_at(POST_ARGS);
 static  int     post_bf(POST_ARGS);  static  int     post_bf(POST_ARGS);
 static  int     post_bl(POST_ARGS);  static  int     post_bl(POST_ARGS);
   static  int     post_bl_head(POST_ARGS);
 static  int     post_it(POST_ARGS);  static  int     post_it(POST_ARGS);
 static  int     post_nm(POST_ARGS);  static  int     post_nm(POST_ARGS);
 static  int     post_root(POST_ARGS);  static  int     post_root(POST_ARGS);
Line 174  static v_post posts_wtext[] = { ewarn_ge1, NULL };
Line 176  static v_post posts_wtext[] = { ewarn_ge1, NULL };
 static  v_post  posts_notext[] = { eerr_eq0, NULL };  static  v_post  posts_notext[] = { eerr_eq0, NULL };
 static  v_post  posts_wline[] = { bwarn_ge1, herr_eq0, NULL };  static  v_post  posts_wline[] = { bwarn_ge1, herr_eq0, NULL };
 static  v_post  posts_sh[] = { herr_ge1, bwarn_ge1, post_sh, NULL };  static  v_post  posts_sh[] = { herr_ge1, bwarn_ge1, post_sh, NULL };
 static  v_post  posts_bl[] = { herr_eq0, bwarn_ge1, post_bl, NULL };  static  v_post  posts_bl[] = { bwarn_ge1, post_bl, NULL };
 static  v_post  posts_it[] = { post_it, NULL };  static  v_post  posts_it[] = { post_it, NULL };
 static  v_post  posts_in[] = { ewarn_eq1, NULL };  static  v_post  posts_in[] = { ewarn_eq1, NULL };
 static  v_post  posts_ss[] = { herr_ge1, NULL };  static  v_post  posts_ss[] = { herr_ge1, NULL };
Line 425  perr(struct mdoc *m, int line, int pos, enum merr type
Line 427  perr(struct mdoc *m, int line, int pos, enum merr type
         case (ENODATA):          case (ENODATA):
                 p = "document has no data";                  p = "document has no data";
                 break;                  break;
           case (ECOLMIS):
                   p = "column syntax style mismatch";
                   break;
         case (EATT):          case (EATT):
                 p = "expected valid AT&T symbol";                  p = "expected valid AT&T symbol";
                 break;                  break;
Line 879  pre_bl(PRE_ARGS)
Line 884  pre_bl(PRE_ARGS)
                 break;                  break;
         }          }
   
         /*  
          * General validation of fields.  
          */  
   
         switch (type) {  
         case (MDOC_Column):  
                 assert(col >= 0);  
                 if (0 == n->args->argv[col].sz)  
                         break;  
                 if ( ! nwarn(mdoc, n, WDEPCOL))  
                         return(0);  
                 break;  
         default:  
                 break;  
         }  
   
         return(1);          return(1);
 }  }
   
Line 1072  post_bf(POST_ARGS)
Line 1061  post_bf(POST_ARGS)
         if (MDOC_BLOCK != mdoc->last->type)          if (MDOC_BLOCK != mdoc->last->type)
                 return(1);                  return(1);
   
         /* FIXME: clean-up .*/  
   
         head = mdoc->last->head;          head = mdoc->last->head;
   
         if (mdoc->last->args && head->child)          if (mdoc->last->args && head->child)
                   return(mdoc_err(mdoc, "one argument expected"));
           else if (mdoc->last->args)
                   return(1);
   
         if (NULL == mdoc->last->args) {          if (NULL == head->child || MDOC_TEXT != head->child->type)
                 if (NULL == head->child ||                  return(mdoc_err(mdoc, "text argument expected"));
                                 MDOC_TEXT != head->child->type)  
                         return(mdoc_err(mdoc, "text argument expected"));  
   
                 p = head->child->string;          p = head->child->string;
                 if (0 == strcmp(p, "Em"))  
                         return(1);  
                 else if (0 == strcmp(p, "Li"))  
                         return(1);  
                 else if (0 == strcmp(p, "Sm"))  
                         return(1);  
                 return(mdoc_nerr(mdoc, head->child, "invalid font"));  
         }  
   
         if (head->child)          if (0 == strcmp(p, "Em"))
                 return(mdoc_err(mdoc, "one argument expected"));                  return(1);
           else if (0 == strcmp(p, "Li"))
                   return(1);
           else if (0 == strcmp(p, "Sm"))
                   return(1);
   
         return(1);          return(mdoc_nerr(mdoc, head->child, "invalid font mode"));
 }  }
   
   
Line 1262  post_it(POST_ARGS)
Line 1246  post_it(POST_ARGS)
   
   
 static int  static int
   post_bl_head(POST_ARGS)
   {
           int                     i;
           const struct mdoc_node *n;
   
           n = mdoc->last->parent;
           assert(n->args);
   
           for (i = 0; i < (int)n->args->argc; i++)
                   if (n->args->argv[i].arg == MDOC_Column)
                           break;
   
           if (i == (int)n->args->argc)
                   return(1);
   
           if (n->args->argv[i].sz && mdoc->last->child)
                   return(nerr(mdoc, n, ECOLMIS));
   
           return(1);
   }
   
   
   static int
 post_bl(POST_ARGS)  post_bl(POST_ARGS)
 {  {
         struct mdoc_node        *n;          struct mdoc_node        *n;
   
           if (MDOC_HEAD == mdoc->last->type)
                   return(post_bl_head(mdoc));
         if (MDOC_BODY != mdoc->last->type)          if (MDOC_BODY != mdoc->last->type)
                 return(1);                  return(1);
         if (NULL == mdoc->last->child)          if (NULL == mdoc->last->child)

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.14

CVSweb