[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.104 and 1.105

version 1.104, 2011/03/20 16:02:05 version 1.105, 2011/03/22 14:05:45
Line 50  static int    in_line(MACRO_PROT_ARGS);
Line 50  static int    in_line(MACRO_PROT_ARGS);
 static  int             obsolete(MACRO_PROT_ARGS);  static  int             obsolete(MACRO_PROT_ARGS);
 static  int             phrase_ta(MACRO_PROT_ARGS);  static  int             phrase_ta(MACRO_PROT_ARGS);
   
   static  int             dword(struct mdoc *, int, int,
                                   const char *, enum mdelim);
 static  int             append_delims(struct mdoc *,  static  int             append_delims(struct mdoc *,
                                 int, int *, char *);                                  int, int *, char *);
 static  enum mdoct      lookup(enum mdoct, const char *);  static  enum mdoct      lookup(enum mdoct, const char *);
Line 580  rew_sub(enum mdoc_type t, struct mdoc *m, 
Line 582  rew_sub(enum mdoc_type t, struct mdoc *m, 
         return(1);          return(1);
 }  }
   
   /*
    * Allocate a word and check whether it's punctuation or not.
    * Punctuation consists of those tokens found in mdoc_isdelim().
    */
   static int
   dword(struct mdoc *m, int line,
                   int col, const char *p, enum mdelim d)
   {
   
           if (DELIM_MAX == d)
                   d = mdoc_isdelim(p);
   
           if ( ! mdoc_word_alloc(m, line, col, p))
                   return(0);
   
           if (DELIM_OPEN == d)
                   m->last->flags |= MDOC_DELIMO;
           else if (DELIM_CLOSE == d)
                   m->last->flags |= MDOC_DELIMC;
   
           return(1);
   }
   
 static int  static int
 append_delims(struct mdoc *m, int line, int *pos, char *buf)  append_delims(struct mdoc *m, int line, int *pos, char *buf)
 {  {
Line 600  append_delims(struct mdoc *m, int line, int *pos, char
Line 624  append_delims(struct mdoc *m, int line, int *pos, char
                 else if (ARGS_EOLN == ac)                  else if (ARGS_EOLN == ac)
                         break;                          break;
   
                 assert(DELIM_NONE != mandoc_isdelim(p));                  dword(m, line, la, p, DELIM_MAX);
                 if ( ! mdoc_word_alloc(m, line, la, p))  
                         return(0);  
   
                 /*                  /*
                  * If we encounter end-of-sentence symbols, then trigger                   * If we encounter end-of-sentence symbols, then trigger
Line 746  blk_exp_close(MACRO_PROT_ARGS)
Line 768  blk_exp_close(MACRO_PROT_ARGS)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, lastarg, p))                          if ( ! dword(m, line, lastarg, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 870  in_line(MACRO_PROT_ARGS)
Line 892  in_line(MACRO_PROT_ARGS)
                  * the word.                   * the word.
                  */                   */
   
                 d = ARGS_QWORD == ac ? DELIM_NONE : mandoc_isdelim(p);                  d = ARGS_QWORD == ac ? DELIM_NONE : mdoc_isdelim(p);
   
                 if (DELIM_NONE != d) {                  if (DELIM_NONE != d) {
                         /*                          /*
Line 905  in_line(MACRO_PROT_ARGS)
Line 927  in_line(MACRO_PROT_ARGS)
   
                 if (DELIM_NONE == d)                  if (DELIM_NONE == d)
                         cnt++;                          cnt++;
                 if ( ! mdoc_word_alloc(m, line, la, p))  
                   if ( ! dword(m, line, la, p, d))
                         return(0);                          return(0);
   
                 /*                  /*
Line 1060  blk_full(MACRO_PROT_ARGS)
Line 1083  blk_full(MACRO_PROT_ARGS)
                                 ARGS_PHRASE != ac &&                                  ARGS_PHRASE != ac &&
                                 ARGS_PPHRASE != ac &&                                  ARGS_PPHRASE != ac &&
                                 ARGS_QWORD != ac &&                                  ARGS_QWORD != ac &&
                                 DELIM_OPEN == mandoc_isdelim(p)) {                                  DELIM_OPEN == mdoc_isdelim(p)) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_OPEN))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1113  blk_full(MACRO_PROT_ARGS)
Line 1136  blk_full(MACRO_PROT_ARGS)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1223  blk_part_imp(MACRO_PROT_ARGS)
Line 1246  blk_part_imp(MACRO_PROT_ARGS)
                         break;                          break;
   
                 if (NULL == body && ARGS_QWORD != ac &&                  if (NULL == body && ARGS_QWORD != ac &&
                     DELIM_OPEN == mandoc_isdelim(p)) {                                  DELIM_OPEN == mdoc_isdelim(p)) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_OPEN))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1238  blk_part_imp(MACRO_PROT_ARGS)
Line 1261  blk_part_imp(MACRO_PROT_ARGS)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1354  blk_part_exp(MACRO_PROT_ARGS)
Line 1377  blk_part_exp(MACRO_PROT_ARGS)
                 /* Flush out leading punctuation. */                  /* Flush out leading punctuation. */
   
                 if (NULL == head && ARGS_QWORD != ac &&                  if (NULL == head && ARGS_QWORD != ac &&
                     DELIM_OPEN == mandoc_isdelim(p)) {                                  DELIM_OPEN == mdoc_isdelim(p)) {
                         assert(NULL == body);                          assert(NULL == body);
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_OPEN))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1377  blk_part_exp(MACRO_PROT_ARGS)
Line 1400  blk_part_exp(MACRO_PROT_ARGS)
                         assert(head);                          assert(head);
                         /* No check whether it's a macro! */                          /* No check whether it's a macro! */
                         if (MDOC_Eo == tok)                          if (MDOC_Eo == tok)
                                 if ( ! mdoc_word_alloc(m, line, la, p))                                  if ( ! dword(m, line, la, p, DELIM_MAX))
                                         return(0);                                          return(0);
   
                         if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))                          if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))
Line 1395  blk_part_exp(MACRO_PROT_ARGS)
Line 1418  blk_part_exp(MACRO_PROT_ARGS)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1500  in_line_argn(MACRO_PROT_ARGS)
Line 1523  in_line_argn(MACRO_PROT_ARGS)
                         break;                          break;
   
                 if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&                  if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
                                 ARGS_QWORD != ac &&                                  ARGS_QWORD != ac && 0 == j &&
                                 0 == j && DELIM_OPEN == mandoc_isdelim(p)) {                                  DELIM_OPEN == mdoc_isdelim(p)) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_OPEN))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 } else if (0 == j)                  } else if (0 == j)
Line 1530  in_line_argn(MACRO_PROT_ARGS)
Line 1553  in_line_argn(MACRO_PROT_ARGS)
                 if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&                  if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
                                 ARGS_QWORD != ac &&                                  ARGS_QWORD != ac &&
                                 ! flushed &&                                  ! flushed &&
                                 DELIM_NONE != mandoc_isdelim(p)) {                                  DELIM_NONE != mdoc_isdelim(p)) {
                         if ( ! rew_elem(m, tok))                          if ( ! rew_elem(m, tok))
                                 return(0);                                  return(0);
                         flushed = 1;                          flushed = 1;
Line 1552  in_line_argn(MACRO_PROT_ARGS)
Line 1575  in_line_argn(MACRO_PROT_ARGS)
                 }                  }
 #endif  #endif
   
                 if ( ! mdoc_word_alloc(m, line, la, p))                  if ( ! dword(m, line, la, p, DELIM_MAX))
                         return(0);                          return(0);
                 j++;                  j++;
         }          }
Line 1623  in_line_eoln(MACRO_PROT_ARGS)
Line 1646  in_line_eoln(MACRO_PROT_ARGS)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1703  phrase(struct mdoc *m, int line, int ppos, char *buf)
Line 1726  phrase(struct mdoc *m, int line, int ppos, char *buf)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }
Line 1748  phrase_ta(MACRO_PROT_ARGS)
Line 1771  phrase_ta(MACRO_PROT_ARGS)
                 ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p);                  ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p);
   
                 if (MDOC_MAX == ntok) {                  if (MDOC_MAX == ntok) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! dword(m, line, la, p, DELIM_MAX))
                                 return(0);                                  return(0);
                         continue;                          continue;
                 }                  }

Legend:
Removed from v.1.104  
changed lines
  Added in v.1.105

CVSweb