[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.45 and 1.46

version 1.45, 2010/05/09 21:06:50 version 1.46, 2010/05/14 12:55:22
Line 398  args(struct mdoc *m, int line, int *pos, 
Line 398  args(struct mdoc *m, int line, int *pos, 
         assert(*pos);          assert(*pos);
         assert(' ' != buf[*pos]);          assert(' ' != buf[*pos]);
   
         if ('\0' == buf[*pos])          if ('\0' == buf[*pos]) {
                   if (ARGS_PPHRASED & fl)
                           return(ARGS_EOLN);
                   /*
                    * If we're not in a partial phrase and the flag for
                    * being a phrase literal is still set, the punctuation
                    * is unterminated.
                    */
                   if (MDOC_PHRASELIT & m->flags)
                           if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))
                                   return(ARGS_ERROR);
   
                   m->flags &= ~MDOC_PHRASELIT;
                 return(ARGS_EOLN);                  return(ARGS_EOLN);
           }
   
         /*          /*
          * If the first character is a closing delimiter and we're to           * If the first character is a closing delimiter and we're to
Line 410  args(struct mdoc *m, int line, int *pos, 
Line 423  args(struct mdoc *m, int line, int *pos, 
   
         if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos]) > 1) {          if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos]) > 1) {
                 for (i = *pos; buf[i]; ) {                  for (i = *pos; buf[i]; ) {
                         if ( mdoc_iscdelim(buf[i]) < 2)                          if (mdoc_iscdelim(buf[i]) < 2)
                                 break;                                  break;
                         i++;                          i++;
                         if ('\0' == buf[i] || ' ' != buf[i])                          if ('\0' == buf[i] || ' ' != buf[i])
Line 444  args(struct mdoc *m, int line, int *pos, 
Line 457  args(struct mdoc *m, int line, int *pos, 
         if (ARGS_TABSEP & fl) {          if (ARGS_TABSEP & fl) {
                 /* Scan ahead to tab (can't be escaped). */                  /* Scan ahead to tab (can't be escaped). */
                 p = strchr(*v, '\t');                  p = strchr(*v, '\t');
                   pp = NULL;
   
                 /* Scan ahead to unescaped `Ta'. */                  /* Scan ahead to unescaped `Ta'. */
                 for (pp = *v; ; pp++) {                  if ( ! (MDOC_PHRASELIT & m->flags))
                         if (NULL == (pp = strstr(pp, "Ta")))                          for (pp = *v; ; pp++) {
                                 break;                                  if (NULL == (pp = strstr(pp, "Ta")))
                         if (pp > *v && ' ' != *(pp - 1))                                          break;
                                 continue;                                  if (pp > *v && ' ' != *(pp - 1))
                         if (' ' == *(pp + 2) || 0 == *(pp + 2))                                          continue;
                                 break;                                  if (' ' == *(pp + 2) || 0 == *(pp + 2))
                 }                                          break;
                           }
   
                 /* By default, assume a phrase. */                  /* By default, assume a phrase. */
                 rc = ARGS_PHRASE;                  rc = ARGS_PHRASE;
Line 506  args(struct mdoc *m, int line, int *pos, 
Line 521  args(struct mdoc *m, int line, int *pos, 
          * Whitespace is NOT involved in literal termination.           * Whitespace is NOT involved in literal termination.
          */           */
   
         if ('\"' == buf[*pos]) {          if (MDOC_PHRASELIT & m->flags || '\"' == buf[*pos]) {
                 *v = &buf[++(*pos)];                  if ( ! (MDOC_PHRASELIT & m->flags))
                           *v = &buf[++(*pos)];
   
                   if (ARGS_PPHRASED & fl)
                           m->flags |= MDOC_PHRASELIT;
   
                 for ( ; buf[*pos]; (*pos)++) {                  for ( ; buf[*pos]; (*pos)++) {
                         if ('\"' != buf[*pos])                          if ('\"' != buf[*pos])
                                 continue;                                  continue;
Line 517  args(struct mdoc *m, int line, int *pos, 
Line 536  args(struct mdoc *m, int line, int *pos, 
                         (*pos)++;                          (*pos)++;
                 }                  }
   
                 if (0 == buf[*pos]) {                  if ('\0' == buf[*pos]) {
                         if (ARGS_NOWARN & fl)                          if (ARGS_NOWARN & fl || ARGS_PPHRASED & fl)
                                 return(ARGS_QWORD);                                  return(ARGS_QWORD);
                         if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))                          if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))
                                 return(ARGS_ERROR);                                  return(ARGS_ERROR);
                         return(ARGS_QWORD);                          return(ARGS_QWORD);
                 }                  }
   
                 buf[(*pos)++] = 0;                  m->flags &= ~MDOC_PHRASELIT;
                   buf[(*pos)++] = '\0';
   
                 if (0 == buf[*pos])                  if ('\0' == buf[*pos])
                         return(ARGS_QWORD);                          return(ARGS_QWORD);
   
                 while (' ' == buf[*pos])                  while (' ' == buf[*pos])
Line 549  args(struct mdoc *m, int line, int *pos, 
Line 569  args(struct mdoc *m, int line, int *pos, 
                 if (' ' == buf[*pos] && '\\' != buf[*pos - 1])                  if (' ' == buf[*pos] && '\\' != buf[*pos - 1])
                         break;                          break;
   
         if (0 == buf[*pos])          if ('\0' == buf[*pos])
                 return(ARGS_WORD);                  return(ARGS_WORD);
   
         buf[(*pos)++] = 0;          buf[(*pos)++] = '\0';
   
         while (' ' == buf[*pos])          while (' ' == buf[*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_pwarn(m, line, *pos, ETAILWS))
                         return(ARGS_ERROR);                          return(ARGS_ERROR);
   

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

CVSweb