[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.2 and 1.3

version 1.2, 1999/04/18 17:06:30 version 1.3, 1999/04/20 17:31:29
Line 164 
Line 164 
 int     sc      = 0;    /* 1 => return a } right now */  int     sc      = 0;    /* 1 => return a } right now */
 int     reg     = 0;    /* 1 => return a REGEXPR now */  int     reg     = 0;    /* 1 => return a REGEXPR now */
   
 int yylex()  int yylex(void)
 {  {
         int c, n;          int c;
         static char *buf = 0;          static char *buf = 0;
         static int bufsize = 500;          static int bufsize = 500;
   
Line 209 
Line 209 
                         RET(';');                          RET(';');
                 case '\\':                  case '\\':
                         if (peek() == '\n') {                          if (peek() == '\n') {
                                 input(); lineno++;                                  input();
                         } else if (peek() == '\r') {                          } else if (peek() == '\r') {
                                 input(); input();       /* \n */                                  input(); input();       /* \n */
                                 lineno++;                                  lineno++;
Line 284 
Line 284 
                         } else                          } else
                                 RET('*');                                  RET('*');
                 case '/':                  case '/':
                         if (peek() == '=') {                          RET('/');
                                 input(); yylval.i = DIVEQ; RET(ASGNOP);  
                         } else  
                                 RET('/');  
                 case '%':                  case '%':
                         if (peek() == '=') {                          if (peek() == '=') {
                                 input(); yylval.i = MODEQ; RET(ASGNOP);                                  input(); yylval.i = MODEQ; RET(ASGNOP);
Line 302 
Line 299 
                 case '$':                  case '$':
                         /* BUG: awkward, if not wrong */                          /* BUG: awkward, if not wrong */
                         c = gettok(&buf, &bufsize);                          c = gettok(&buf, &bufsize);
                         if (c == '(' || c == '[' || (infunc && (n=isarg(buf)) >= 0)) {                          if (c == '(' || c == '[' || (infunc && isarg(buf) >= 0)) {
                                 unputstr(buf);                                  unputstr(buf);
                                 RET(INDIRECT);                                  RET(INDIRECT);
                         } else if (isalpha(c)) {                          } else if (isalpha(c)) {
Line 349 
Line 346 
         }          }
 }  }
   
 int string()  int string(void)
 {  {
         int c, n;          int c, n;
         char *s, *bp;          char *s, *bp;
Line 378 
Line 375 
                         case 'r': *bp++ = '\r'; break;                          case 'r': *bp++ = '\r'; break;
                         case 'b': *bp++ = '\b'; break;                          case 'b': *bp++ = '\b'; break;
                         case 'v': *bp++ = '\v'; break;                          case 'v': *bp++ = '\v'; break;
                         case 'a': *bp++ = '\a'; break;                          case 'a': *bp++ = '\007'; break;
                         case '\\': *bp++ = '\\'; break;                          case '\\': *bp++ = '\\'; break;
   
                         case '0': case '1': case '2': /* octal: \d \dd \ddd */                          case '0': case '1': case '2': /* octal: \d \dd \ddd */
Line 493 
Line 490 
         reg = 1;          reg = 1;
 }  }
   
 int regexpr()  int regexpr(void)
 {  {
         int c;          int c;
         static char *buf = 0;          static char *buf = 0;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3