*** empty log message ***
[minix3.git] / commands / flex-2.5.4 / MISC / fastwc / wc2.l
blobbd63cd4908bec0d721c75d45d64ae25f7fd943d1
1 /* Somewhat faster "wc" tool: match more text with each rule */
3 ws    [ \t]
4 nonws [^ \t\n]
5 word  {ws}*{nonws}+
7 %%
8         int cc = 0, wc = 0, lc = 0;
10 {word}{ws}*     cc += yyleng; ++wc;
11 {word}{ws}*\n   cc += yyleng; ++wc; ++lc;
13 {ws}+           cc += yyleng;
15 \n+             cc += yyleng; lc += yyleng;
17 <<EOF>>         {
18                 printf( "%8d %8d %8d\n", lc, wc, cc );
19                 yyterminate();
20                 }