1 /* Fastest version of wc: add rules to pick up newlines, too */
10 int cc = 0, wc = 0, lc = 0;
12 {word}{ws}* ++wc; cc += yyleng;
13 {word}{ws}*\n ++wc; cc += yyleng; ++lc;
14 {words}{word}{ws}* wc += 2; cc += yyleng;
15 {words}{word}{ws}*\n wc += 2; cc += yyleng; ++lc;
16 {words}{2}{word}{ws}* wc += 3; cc += yyleng;
17 {words}{2}{word}{ws}*\n wc += 3; cc += yyleng; ++lc;
18 {words}{3}{word}{ws}* wc += 4; cc += yyleng;
19 {words}{3}{word}{ws}*\n wc += 4; cc += yyleng; ++lc;
23 \n+ cc += yyleng; lc += yyleng;
26 printf( "%8d %8d %8d\n", lc, wc, cc );