[BACK]Return to lex.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / awk

Diff for /src/usr.bin/awk/lex.c between version 1.12 and 1.13

version 1.12, 2011/09/28 19:27:18 version 1.13, 2020/06/10 21:01:32
Line 209 
Line 209 
                 yylval.i = c;                  yylval.i = c;
                 switch (c) {                  switch (c) {
                 case '\n':      /* {EOL} */                  case '\n':      /* {EOL} */
                           lineno++;
                         RET(NL);                          RET(NL);
                 case '\r':      /* assume \n is coming */                  case '\r':      /* assume \n is coming */
                 case ' ':       /* {WS}+ */                  case ' ':       /* {WS}+ */
Line 224 
Line 225 
                 case '\\':                  case '\\':
                         if (peek() == '\n') {                          if (peek() == '\n') {
                                 input();                                  input();
                                   lineno++;
                         } else if (peek() == '\r') {                          } else if (peek() == '\r') {
                                 input(); input();       /* \n */                                  input(); input();       /* \n */
                                 lineno++;                                  lineno++;
Line 381 
Line 383 
                 case '\n':                  case '\n':
                 case '\r':                  case '\r':
                 case 0:                  case 0:
                           *bp = '\0';
                         SYNTAX( "non-terminated string %.10s...", buf );                          SYNTAX( "non-terminated string %.10s...", buf );
                         lineno++;  
                         if (c == 0)     /* hopeless */                          if (c == 0)     /* hopeless */
                                 FATAL( "giving up" );                                  FATAL( "giving up" );
                           lineno++;
                         break;                          break;
                 case '\\':                  case '\\':
                         c = input();                          c = input();
Line 526 
Line 529 
                 if (!adjbuf(&buf, &bufsz, bp-buf+3, 500, &bp, "regexpr"))                  if (!adjbuf(&buf, &bufsz, bp-buf+3, 500, &bp, "regexpr"))
                         FATAL("out of space for reg expr %.10s...", buf);                          FATAL("out of space for reg expr %.10s...", buf);
                 if (c == '\n') {                  if (c == '\n') {
                           *bp = '\0';
                         SYNTAX( "newline in regular expression %.10s...", buf );                          SYNTAX( "newline in regular expression %.10s...", buf );
                         unput('\n');                          unput('\n');
                         break;                          break;
Line 568 
Line 572 
                         lexprog++;                          lexprog++;
         } else                          /* awk -f ... */          } else                          /* awk -f ... */
                 c = pgetc();                  c = pgetc();
         if (c == '\n')          if (c == EOF)
                 lineno++;  
         else if (c == EOF)  
                 c = 0;                  c = 0;
         if (ep >= ebuf + sizeof ebuf)          if (ep >= ebuf + sizeof ebuf)
                 ep = ebuf;                  ep = ebuf;
         return *ep++ = c;          *ep = c;
           if (c != 0) {
                   ep++;
           }
           return (c);
 }  }
   
 void unput(int c)       /* put lexical character back on input */  void unput(int c)       /* put lexical character back on input */
 {  {
         if (c == '\n')  
                 lineno--;  
         if (yysptr >= yysbuf + sizeof(yysbuf))          if (yysptr >= yysbuf + sizeof(yysbuf))
                 FATAL("pushed back too much: %.20s...", yysbuf);                  FATAL("pushed back too much: %.20s...", yysbuf);
         *yysptr++ = c;          *yysptr++ = c;

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13