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

Diff for /mandoc/mdoc_macro.c between version 1.145 and 1.148

version 1.145, 2014/11/20 00:31:28 version 1.148, 2014/11/27 22:27:56
Line 171  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 171  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |          { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
                         MDOC_EXPLICIT | MDOC_JOIN }, /* So */                          MDOC_EXPLICIT | MDOC_JOIN }, /* So */
         { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sq */          { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sq */
         { in_line_eoln, 0 }, /* Sm */          { in_line_argn, 0 }, /* Sm */
         { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sx */          { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sx */
         { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sy */          { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sy */
         { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */          { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */
Line 437  rew_dohalt(enum mdoct tok, enum mdoc_type type,
Line 437  rew_dohalt(enum mdoct tok, enum mdoc_type type,
          * Default block rewinding rules.           * Default block rewinding rules.
          * In particular, always skip block end markers,           * In particular, always skip block end markers,
          * and let all blocks rewind Nm children.           * and let all blocks rewind Nm children.
            * Do not warn again when closing a block,
            * since closing the body already warned.
          */           */
         if (ENDBODY_NOT != p->end || MDOC_Nm == p->tok ||          if (ENDBODY_NOT != p->end || MDOC_Nm == p->tok ||
             (MDOC_BLOCK == p->type &&              MDOC_BLOCK == type || (MDOC_BLOCK == p->type &&
             ! (MDOC_EXPLICIT & mdoc_macros[tok].flags)))              ! (MDOC_EXPLICIT & mdoc_macros[tok].flags)))
                 return(REWIND_MORE);                  return(REWIND_MORE);
   
Line 691  static int
Line 693  static int
 blk_exp_close(MACRO_PROT_ARGS)  blk_exp_close(MACRO_PROT_ARGS)
 {  {
         struct mdoc_node *body;         /* Our own body. */          struct mdoc_node *body;         /* Our own body. */
           struct mdoc_node *endbody;      /* Our own end marker. */
         struct mdoc_node *later;        /* A sub-block starting later. */          struct mdoc_node *later;        /* A sub-block starting later. */
         struct mdoc_node *n;            /* For searching backwards. */          struct mdoc_node *n;            /* For searching backwards. */
   
Line 717  blk_exp_close(MACRO_PROT_ARGS)
Line 720  blk_exp_close(MACRO_PROT_ARGS)
          * both of our own and of pending sub-blocks.           * both of our own and of pending sub-blocks.
          */           */
         atok = rew_alt(tok);          atok = rew_alt(tok);
         body = later = NULL;          body = endbody = later = NULL;
         for (n = mdoc->last; n; n = n->parent) {          for (n = mdoc->last; n; n = n->parent) {
                 if (MDOC_VALID & n->flags)                  if (MDOC_VALID & n->flags)
                         continue;                          continue;
Line 756  blk_exp_close(MACRO_PROT_ARGS)
Line 759  blk_exp_close(MACRO_PROT_ARGS)
                         if ( ! mdoc_endbody_alloc(mdoc, line, ppos,                          if ( ! mdoc_endbody_alloc(mdoc, line, ppos,
                             atok, body, ENDBODY_SPACE))                              atok, body, ENDBODY_SPACE))
                                 return(0);                                  return(0);
                           if (maxargs) {
                                   endbody = mdoc->last;
                                   mdoc->next = MDOC_NEXT_CHILD;
                           }
                         break;                          break;
                 }                  }
   
Line 785  blk_exp_close(MACRO_PROT_ARGS)
Line 792  blk_exp_close(MACRO_PROT_ARGS)
         if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))          if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
                 return(0);                  return(0);
   
         if (NULL == later && maxargs > 0)          if (maxargs && endbody == NULL) {
                 if ( ! mdoc_tail_alloc(mdoc, line, ppos, rew_alt(tok)))                  if (n == NULL) {
                           /*
                            * Stray .Ec without previous .Eo:
                            * Break the output line, ignore any arguments.
                            */
                           if ( ! mdoc_elem_alloc(mdoc, line, ppos,
                               MDOC_br, NULL))
                                   return(0);
                           if ( ! rew_elem(mdoc, MDOC_br))
                                   return(0);
                   } else if ( ! mdoc_tail_alloc(mdoc, line, ppos, atok))
                         return(0);                          return(0);
           }
   
         for (flushed = j = 0; ; j++) {          flushed = n == NULL;
           for (j = 0; ; j++) {
                 lastarg = *pos;                  lastarg = *pos;
   
                 if (j == maxargs && ! flushed) {                  if (j == maxargs && ! flushed) {
                         if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))                          if ( ! (endbody != NULL ? rew_last(mdoc, endbody) :
                               rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)))
                                 return(0);                                  return(0);
                         flushed = 1;                          flushed = 1;
                 }                  }
Line 817  blk_exp_close(MACRO_PROT_ARGS)
Line 837  blk_exp_close(MACRO_PROT_ARGS)
                 }                  }
   
                 if ( ! flushed) {                  if ( ! flushed) {
                         if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))                          if ( ! (endbody != NULL ? rew_last(mdoc, endbody) :
                               rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)))
                                 return(0);                                  return(0);
                         flushed = 1;                          flushed = 1;
                 }                  }
Line 829  blk_exp_close(MACRO_PROT_ARGS)
Line 850  blk_exp_close(MACRO_PROT_ARGS)
                 break;                  break;
         }          }
   
         if ( ! flushed && ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))          if ( ! flushed && ! (endbody != NULL ? rew_last(mdoc, endbody) :
               rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)))
                 return(0);                  return(0);
   
         if ( ! nl)          if ( ! nl)

Legend:
Removed from v.1.145  
changed lines
  Added in v.1.148

CVSweb