home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib1 / v_01_06 / 1n06040b < prev    next >
Encoding:
Text File  |  1995-11-01  |  314 b   |  27 lines

  1.  
  2. Listing 7
  3.  
  4. static int c;
  5.  
  6. int yylex(void)
  7.     {
  8.     int tc;
  9.  
  10.     while (isspace(c) && c != '\n')
  11.         c = getchar();
  12.     if (isdigit(c))
  13.         {
  14.         yylval = 0;
  15.         do
  16.             yylval = 10 * yylval + c - '0';
  17.         while (isdigit(c = getchar()));
  18.         return INT;
  19.         }
  20.     else
  21.         {
  22.         tc = c;
  23.         c = getchar();
  24.         return tc;
  25.         }
  26.  
  27.