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

Diff for /mandoc/mdoc_argv.c between version 1.48 and 1.50

version 1.48, 2010/05/15 08:54:04 version 1.50, 2010/05/30 23:59:59
Line 26 
Line 26 
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
   
   #include "mandoc.h"
 #include "libmdoc.h"  #include "libmdoc.h"
 #include "libmandoc.h"  #include "libmandoc.h"
   
Line 338  enum margserr
Line 339  enum margserr
 mdoc_args(struct mdoc *m, int line, int *pos,  mdoc_args(struct mdoc *m, int line, int *pos,
                 char *buf, enum mdoct tok, char **v)                  char *buf, enum mdoct tok, char **v)
 {  {
         int               fl, c, i;          int               fl;
         struct mdoc_node *n;          struct mdoc_node *n;
   
         fl = mdoc_argflags[tok];          fl = mdoc_argflags[tok];
Line 346  mdoc_args(struct mdoc *m, int line, int *pos, 
Line 347  mdoc_args(struct mdoc *m, int line, int *pos, 
         if (MDOC_It != tok)          if (MDOC_It != tok)
                 return(args(m, line, pos, buf, fl, v));                  return(args(m, line, pos, buf, fl, v));
   
         /*  
          * The `It' macro is a special case, as it acquires parameters from its  
          * parent `Bl' context, specifically, we're concerned with -column.  
          */  
   
         for (n = m->last; n; n = n->parent)          for (n = m->last; n; n = n->parent)
                 if (MDOC_BLOCK == n->type && MDOC_Bl == n->tok)                  if (MDOC_Bl == n->tok)
                         break;                          break;
   
         assert(n);          if (n && LIST_column == n->data.list) {
         c = (int)(n->args ? n->args->argc : 0);  
         assert(c > 0);  
   
         /* LINTED */  
         for (i = 0; i < c; i++) {  
                 if (MDOC_Column != n->args->argv[i].arg)  
                         continue;  
                 fl |= ARGS_TABSEP;                  fl |= ARGS_TABSEP;
                 fl &= ~ARGS_DELIM;                  fl &= ~ARGS_DELIM;
                 break;  
         }          }
   
         return(args(m, line, pos, buf, fl, v));          return(args(m, line, pos, buf, fl, v));
Line 407  args(struct mdoc *m, int line, int *pos, 
Line 395  args(struct mdoc *m, int line, int *pos, 
                  * is unterminated.                   * is unterminated.
                  */                   */
                 if (MDOC_PHRASELIT & m->flags)                  if (MDOC_PHRASELIT & m->flags)
                         if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))                          if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_BADQUOTE))
                                 return(ARGS_ERROR);                                  return(ARGS_ERROR);
   
                 m->flags &= ~MDOC_PHRASELIT;                  m->flags &= ~MDOC_PHRASELIT;
Line 440  args(struct mdoc *m, int line, int *pos, 
Line 428  args(struct mdoc *m, int line, int *pos, 
                                 return(ARGS_PUNCT);                                  return(ARGS_PUNCT);
                         if (ARGS_NOWARN & fl)                          if (ARGS_NOWARN & fl)
                                 return(ARGS_PUNCT);                                  return(ARGS_PUNCT);
                         if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))                          if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
                                 return(ARGS_ERROR);                                  return(ARGS_ERROR);
                         return(ARGS_PUNCT);                          return(ARGS_PUNCT);
                 }                  }
Line 495  args(struct mdoc *m, int line, int *pos, 
Line 483  args(struct mdoc *m, int line, int *pos, 
   
                 /* Whitespace check for eoln case... */                  /* Whitespace check for eoln case... */
                 if (0 == *p && ' ' == *(p - 1) && ! (ARGS_NOWARN & fl))                  if (0 == *p && ' ' == *(p - 1) && ! (ARGS_NOWARN & fl))
                         if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))                          if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
                                 return(ARGS_ERROR);                                  return(ARGS_ERROR);
   
                 *pos += (int)(p - *v);                  *pos += (int)(p - *v);
Line 540  args(struct mdoc *m, int line, int *pos, 
Line 528  args(struct mdoc *m, int line, int *pos, 
                 if ('\0' == buf[*pos]) {                  if ('\0' == buf[*pos]) {
                         if (ARGS_NOWARN & fl || MDOC_PPHRASE & m->flags)                          if (ARGS_NOWARN & fl || MDOC_PPHRASE & m->flags)
                                 return(ARGS_QWORD);                                  return(ARGS_QWORD);
                         if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))                          if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_BADQUOTE))
                                 return(ARGS_ERROR);                                  return(ARGS_ERROR);
                         return(ARGS_QWORD);                          return(ARGS_QWORD);
                 }                  }
Line 555  args(struct mdoc *m, int line, int *pos, 
Line 543  args(struct mdoc *m, int line, int *pos, 
                         (*pos)++;                          (*pos)++;
   
                 if (0 == buf[*pos] && ! (ARGS_NOWARN & fl))                  if (0 == buf[*pos] && ! (ARGS_NOWARN & fl))
                         if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))                          if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
                                 return(ARGS_ERROR);                                  return(ARGS_ERROR);
   
                 return(ARGS_QWORD);                  return(ARGS_QWORD);
Line 579  args(struct mdoc *m, int line, int *pos, 
Line 567  args(struct mdoc *m, int line, int *pos, 
                 (*pos)++;                  (*pos)++;
   
         if ('\0' == buf[*pos] && ! (ARGS_NOWARN & fl))          if ('\0' == buf[*pos] && ! (ARGS_NOWARN & fl))
                 if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))                  if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
                         return(ARGS_ERROR);                          return(ARGS_ERROR);
   
         return(ARGS_WORD);          return(ARGS_WORD);
Line 751  argv_single(struct mdoc *m, int line, 
Line 739  argv_single(struct mdoc *m, int line, 
         ppos = *pos;          ppos = *pos;
   
         ac = args(m, line, pos, buf, 0, &p);          ac = args(m, line, pos, buf, 0, &p);
         if (ARGS_ERROR == ac)          if (ARGS_EOLN == ac) {
                   mdoc_pmsg(m, line, ppos, MANDOCERR_SYNTARGVCOUNT);
                 return(0);                  return(0);
         if (ARGS_EOLN == ac)          } else if (ARGS_ERROR == ac)
                 return(mdoc_perr(m, line, ppos, EARGVAL));                  return(0);
   
         v->sz = 1;          v->sz = 1;
         v->value = mandoc_malloc(sizeof(char *));          v->value = mandoc_malloc(sizeof(char *));

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.50

CVSweb