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

Diff for /mandoc/mdoc.c between version 1.226 and 1.229

version 1.226, 2014/10/16 01:11:20 version 1.229, 2014/11/19 03:08:17
Line 205  mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep)
Line 205  mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep)
   
         n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, MDOC_EQN);          n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, MDOC_EQN);
         n->eqn = ep;          n->eqn = ep;
           if (ep->ln > mdoc->last->line)
                   n->flags |= MDOC_LINE;
   
         if ( ! node_append(mdoc, n))          if ( ! node_append(mdoc, n))
                 return(0);                  return(0);
Line 236  int
Line 238  int
 mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)  mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
 {  {
   
         mdoc->flags |= MDOC_NEWLINE;          if (mdoc->last->type != MDOC_EQN || ln > mdoc->last->line)
                   mdoc->flags |= MDOC_NEWLINE;
   
         /*          /*
          * Let the roff nS register switch SYNOPSIS mode early,           * Let the roff nS register switch SYNOPSIS mode early,
Line 731  mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int
Line 734  mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int
 static int  static int
 mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)  mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
 {  {
           struct mdoc_node *n;
           const char       *cp;
         enum mdoct        tok;          enum mdoct        tok;
         int               i, sv;          int               i, sv;
         char              mac[5];          char              mac[5];
         struct mdoc_node *n;  
   
         sv = offs;          sv = offs;
   
         /*          /*
          * Copy the first word into a nil-terminated buffer.           * Copy the first word into a nil-terminated buffer.
          * Stop copying when a tab, space, or eoln is encountered.           * Stop when a space, tab, escape, or eoln is encountered.
          */           */
   
         i = 0;          i = 0;
         while (i < 4 && '\0' != buf[offs] && ' ' != buf[offs] &&          while (i < 4 && strchr(" \t\\", buf[offs]) == NULL)
             '\t' != buf[offs])  
                 mac[i++] = buf[offs++];                  mac[i++] = buf[offs++];
   
         mac[i] = '\0';          mac[i] = '\0';
   
         tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX;          tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX;
   
         if (MDOC_MAX == tok) {          if (tok == MDOC_MAX) {
                 mandoc_msg(MANDOCERR_MACRO, mdoc->parse,                  mandoc_msg(MANDOCERR_MACRO, mdoc->parse,
                     ln, sv, buf + sv - 1);                      ln, sv, buf + sv - 1);
                 return(1);                  return(1);
         }          }
   
         /* Disregard the first trailing tab, if applicable. */          /* Skip a leading escape sequence or tab. */
   
         if ('\t' == buf[offs])          switch (buf[offs]) {
           case '\\':
                   cp = buf + offs + 1;
                   mandoc_escape(&cp, NULL, NULL);
                   offs = cp - buf;
                   break;
           case '\t':
                 offs++;                  offs++;
                   break;
           default:
                   break;
           }
   
         /* Jump to the next non-whitespace word. */          /* Jump to the next non-whitespace word. */
   

Legend:
Removed from v.1.226  
changed lines
  Added in v.1.229

CVSweb