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

Diff for /mandoc/Attic/validate.c between version 1.30 and 1.31

version 1.30, 2009/01/15 17:38:58 version 1.31, 2009/01/16 11:50:54
Line 200  bodychild_err_eq0(struct mdoc *mdoc)
Line 200  bodychild_err_eq0(struct mdoc *mdoc)
                 return(1);                  return(1);
         if (NULL == mdoc->last->child)          if (NULL == mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_warn(mdoc, WARN_ARGS_EQ0));          return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests no body children"));
 }  }
   
   
Line 212  bodychild_warn_ge1(struct mdoc *mdoc)
Line 212  bodychild_warn_ge1(struct mdoc *mdoc)
                 return(1);                  return(1);
         if (mdoc->last->child)          if (mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_warn(mdoc, WARN_ARGS_GE1));          return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests one or more body children"));
 }  }
   
   
Line 224  elemchild_warn_eq0(struct mdoc *mdoc)
Line 224  elemchild_warn_eq0(struct mdoc *mdoc)
         if (NULL == mdoc->last->child)          if (NULL == mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_pwarn(mdoc, mdoc->last->child->line,          return(mdoc_pwarn(mdoc, mdoc->last->child->line,
                         mdoc->last->child->pos, WARN_ARGS_EQ0));                          mdoc->last->child->pos, WARN_SYNTAX, "macro suggests no parameters"));
 }  }
   
   
Line 235  elemchild_warn_ge1(struct mdoc *mdoc)
Line 235  elemchild_warn_ge1(struct mdoc *mdoc)
         assert(MDOC_ELEM == mdoc->last->type);          assert(MDOC_ELEM == mdoc->last->type);
         if (mdoc->last->child)          if (mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_warn(mdoc, WARN_ARGS_GE1));          return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests one or more parameters"));
 }  }
   
   
Line 246  elemchild_err_eq0(struct mdoc *mdoc)
Line 246  elemchild_err_eq0(struct mdoc *mdoc)
         assert(MDOC_ELEM == mdoc->last->type);          assert(MDOC_ELEM == mdoc->last->type);
         if (NULL == mdoc->last->child)          if (NULL == mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_err(mdoc, ERR_ARGS_EQ0));          return(mdoc_err(mdoc, "macro expects no parameters"));
 }  }
   
   
Line 257  elemchild_err_ge1(struct mdoc *mdoc)
Line 257  elemchild_err_ge1(struct mdoc *mdoc)
         assert(MDOC_ELEM == mdoc->last->type);          assert(MDOC_ELEM == mdoc->last->type);
         if (mdoc->last->child)          if (mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_err(mdoc, ERR_ARGS_GE1));          return(mdoc_err(mdoc, "macro expects one or more parameters"));
 }  }
   
   
Line 270  headchild_err_eq0(struct mdoc *mdoc)
Line 270  headchild_err_eq0(struct mdoc *mdoc)
         if (NULL == mdoc->last->child)          if (NULL == mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_perr(mdoc, mdoc->last->child->line,          return(mdoc_perr(mdoc, mdoc->last->child->line,
                         mdoc->last->child->pos, ERR_ARGS_EQ0));                          mdoc->last->child->pos, "macro expects no parameters"));
 }  }
   
   
Line 282  headchild_warn_ge1(struct mdoc *mdoc)
Line 282  headchild_warn_ge1(struct mdoc *mdoc)
                 return(1);                  return(1);
         if (mdoc->last->child)          if (mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_warn(mdoc, WARN_ARGS_GE1));          return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests one or more parameters"));
 }  }
   
   
Line 294  headchild_err_ge1(struct mdoc *mdoc)
Line 294  headchild_err_ge1(struct mdoc *mdoc)
                 return(1);                  return(1);
         if (mdoc->last->child)          if (mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_err(mdoc, ERR_ARGS_GE1));          return(mdoc_err(mdoc, "macro expects one or more parameters"));
 }  }
   
   
Line 312  pre_display(struct mdoc *mdoc, struct mdoc_node *node)
Line 312  pre_display(struct mdoc *mdoc, struct mdoc_node *node)
                                 break;                                  break;
         if (NULL == n)          if (NULL == n)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, node, ERR_SCOPE_NONEST));          return(mdoc_nerr(mdoc, node, "displays may not be nested"));
 }  }
   
   
Line 364  pre_bl(struct mdoc *mdoc, struct mdoc_node *node)
Line 364  pre_bl(struct mdoc *mdoc, struct mdoc_node *node)
                 }                  }
         }          }
         if (0 == type)          if (0 == type)
                 return(mdoc_err(mdoc, ERR_SYNTAX_ARGMISS));                  return(mdoc_err(mdoc, "no list type specified"));
         if (0 == err)          if (0 == err)
                 return(1);                  return(1);
         assert(argv);          assert(argv);
         return(mdoc_perr(mdoc, argv->line,          return(mdoc_perr(mdoc, argv->line,
                         argv->pos, ERR_SYNTAX_ARGBAD));                          argv->pos, "only one list type possible"));
 }  }
   
   
Line 409  pre_bd(struct mdoc *mdoc, struct mdoc_node *node)
Line 409  pre_bd(struct mdoc *mdoc, struct mdoc_node *node)
                 }                  }
         }          }
         if (0 == type)          if (0 == type)
                 return(mdoc_err(mdoc, ERR_SYNTAX_ARGMISS));                  return(mdoc_err(mdoc, "no display type specified"));
         if (0 == err)          if (0 == err)
                 return(1);                  return(1);
         assert(argv);          assert(argv);
         return(mdoc_perr(mdoc, argv->line,          return(mdoc_perr(mdoc, argv->line,
                         argv->pos, ERR_SYNTAX_ARGBAD));                          argv->pos, "only one display type possible"));
 }  }
   
   
Line 427  pre_it(struct mdoc *mdoc, struct mdoc_node *node)
Line 427  pre_it(struct mdoc *mdoc, struct mdoc_node *node)
         assert(MDOC_It == mdoc->last->tok);          assert(MDOC_It == mdoc->last->tok);
   
         if (MDOC_BODY != mdoc->last->parent->type)          if (MDOC_BODY != mdoc->last->parent->type)
                 return(mdoc_nerr(mdoc, node, ERR_SYNTAX_PARENTBAD));                  return(mdoc_nerr(mdoc, node, "invalid macro parent `%s'", mdoc_macronames[mdoc->last->parent->tok]));
         if (MDOC_Bl != mdoc->last->parent->tok)          if (MDOC_Bl != mdoc->last->parent->tok)
                 return(mdoc_nerr(mdoc, node, ERR_SYNTAX_PARENTBAD));                  return(mdoc_nerr(mdoc, node, "invalid macro parent `%s'", mdoc_macronames[mdoc->last->parent->tok]));
   
         return(1);          return(1);
 }  }
Line 440  pre_prologue(struct mdoc *mdoc, struct mdoc_node *node
Line 440  pre_prologue(struct mdoc *mdoc, struct mdoc_node *node
 {  {
   
         if (SEC_PROLOGUE != mdoc->sec_lastn)          if (SEC_PROLOGUE != mdoc->sec_lastn)
                 return(mdoc_nerr(mdoc, node, ERR_SEC_NPROLOGUE));                  return(mdoc_nerr(mdoc, node, "macro may only be invoked in the prologue"));
         assert(MDOC_ELEM == node->type);          assert(MDOC_ELEM == node->type);
   
         /* Check for ordering. */          /* Check for ordering. */
Line 449  pre_prologue(struct mdoc *mdoc, struct mdoc_node *node
Line 449  pre_prologue(struct mdoc *mdoc, struct mdoc_node *node
         case (MDOC_Os):          case (MDOC_Os):
                 if (mdoc->meta.title[0] && mdoc->meta.date)                  if (mdoc->meta.title[0] && mdoc->meta.date)
                         break;                          break;
                 return(mdoc_nerr(mdoc, node, ERR_SEC_PROLOGUE_OO));                  return(mdoc_nerr(mdoc, node, "prologue macro out-of-order"));
         case (MDOC_Dt):          case (MDOC_Dt):
                 if (0 == mdoc->meta.title[0] && mdoc->meta.date)                  if (0 == mdoc->meta.title[0] && mdoc->meta.date)
                         break;                          break;
                 return(mdoc_nerr(mdoc, node, ERR_SEC_PROLOGUE_OO));                  return(mdoc_nerr(mdoc, node, "prologue macro out-of-order"));
         case (MDOC_Dd):          case (MDOC_Dd):
                 if (0 == mdoc->meta.title[0] && 0 == mdoc->meta.date)                  if (0 == mdoc->meta.title[0] && 0 == mdoc->meta.date)
                         break;                          break;
                 return(mdoc_nerr(mdoc, node, ERR_SEC_PROLOGUE_OO));                  return(mdoc_nerr(mdoc, node, "prologue macro out-of-order"));
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */                  /* NOTREACHED */
Line 483  pre_prologue(struct mdoc *mdoc, struct mdoc_node *node
Line 483  pre_prologue(struct mdoc *mdoc, struct mdoc_node *node
                 /* NOTREACHED */                  /* NOTREACHED */
         }          }
   
         return(mdoc_nerr(mdoc, node, ERR_SEC_PROLOGUE_REP));          return(mdoc_nerr(mdoc, node, "prologue macro repeated"));
 }  }
   
   
Line 552  post_it(struct mdoc *mdoc)
Line 552  post_it(struct mdoc *mdoc)
   
         if (TYPE_HEAD == type) {          if (TYPE_HEAD == type) {
                 if (NULL == (n = mdoc->last->data.block.head)) {                  if (NULL == (n = mdoc->last->data.block.head)) {
                         if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD))                          if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters"))
                                 return(0);                                  return(0);
                 } else if (NULL == n->child)                  } else if (NULL == n->child)
                         if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD))                          if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters"))
                                 return(0);                                  return(0);
   
                 if (NULL == (n = mdoc->last->data.block.body)) {                  if (NULL == (n = mdoc->last->data.block.body)) {
                         if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYBODY))                          if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests body children"))
                                 return(0);                                  return(0);
                 } else if (NULL == n->child)                  } else if (NULL == n->child)
                         if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYBODY))                          if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests body children"))
                                 return(0);                                  return(0);
   
                 return(1);                  return(1);
         }          }
   
         if (NULL == (n = mdoc->last->data.block.head)) {          if (NULL == (n = mdoc->last->data.block.head)) {
                 if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD))                  if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters"))
                         return(0);                          return(0);
         } else if (NULL == n->child)          } else if (NULL == n->child)
                 if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD))                  if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters"))
                         return(0);                          return(0);
   
         if ((n = mdoc->last->data.block.body) && n->child)          if ((n = mdoc->last->data.block.body) && n->child)
                 if ( ! mdoc_warn(mdoc, WARN_SYNTAX_NOBODY))                  if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests body children"))
                         return(0);                          return(0);
   
         if (MDOC_Column != sv)          if (MDOC_Column != sv)
Line 592  post_it(struct mdoc *mdoc)
Line 592  post_it(struct mdoc *mdoc)
   
         if (i == (size_t)sv)          if (i == (size_t)sv)
                 return(1);                  return(1);
         return(mdoc_err(mdoc, ERR_SYNTAX_ARGFORM));          return(mdoc_err(mdoc, "expected %d list columns, have %d", sv, (int)i));
   
 #undef  TYPE_NONE  #undef  TYPE_NONE
 #undef  TYPE_BODY  #undef  TYPE_BODY
Line 618  post_bl(struct mdoc *mdoc)
Line 618  post_bl(struct mdoc *mdoc)
         }          }
         if (NULL == n)          if (NULL == n)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, n, ERR_SYNTAX_CHILDBAD));          return(mdoc_nerr(mdoc, n, "invalid child of parent macro `Bl'"));
 }  }
   
   
Line 653  post_sh(struct mdoc *mdoc)
Line 653  post_sh(struct mdoc *mdoc)
                 return(1);                  return(1);
   
         if (sec == mdoc->sec_lastn)          if (sec == mdoc->sec_lastn)
                 return(mdoc_warn(mdoc, WARN_SEC_REP));                  return(mdoc_warn(mdoc, WARN_SYNTAX, "section repeated"));
         return(mdoc_warn(mdoc, WARN_SEC_OO));          return(mdoc_warn(mdoc, WARN_SYNTAX, "section out of conventional order"));
 }  }
   
   

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

CVSweb