home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_01_06 / 1n06039b < prev    next >
Text File  |  1990-10-02  |  459b  |  39 lines

  1.  
  2. Listing 5
  3.  
  4. /*
  5.  * scan.c
  6.  */
  7. #include <ctype.h>
  8. #include <limits.h>
  9. #include <stdio.h>
  10.  
  11. #include "scan.h"
  12.  
  13. int yylex(void)
  14.     {
  15.     int c;
  16.  
  17.     while (isspace(c = getchar()) && c != '\n')
  18.         ;
  19.     if (isdigit(c))
  20.         {
  21.         yylval = 0;
  22.         do
  23.             yylval = 10 * yylval + c - '0';
  24.         while (isdigit(c = getchar()));
  25.         ungetc(c, stdin);
  26.         return INT;
  27.         }
  28.     return c;
  29.     }
  30.  
  31. void yyrestart(void)
  32.     {
  33.     int c;
  34.     
  35.     while ((c = getchar()) != '\n')
  36.         ;
  37.     }
  38.  
  39.