home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / flex-2.4.7-src.lha / GNU / src / amiga / flex-2.4.7 / MISC / fastwc / wc1.l < prev    next >
Encoding:
Text File  |  1993-07-23  |  247 b   |  19 lines

  1. /* First cut at a flex-based "wc" tool. */
  2.  
  3. ws    [ \t]
  4. nonws [^ \t\n]
  5.  
  6. %%
  7.     int cc = 0, wc = 0, lc = 0;
  8.  
  9. {nonws}+    cc += yyleng; ++wc;
  10.  
  11. {ws}+        cc += yyleng;
  12.  
  13. \n        ++lc; ++cc;
  14.  
  15. <<EOF>>        {
  16.         printf( "%8d %8d %8d\n", lc, wc, cc );
  17.         yyterminate();
  18.         }
  19.