*** empty log message ***
[minix3.git] / commands / flex-2.5.4 / MISC / fastwc / wc5.l
blob8fe17b622ed5d6f78baf727a1fc5d59fc9f1577b
1 /* Oops; slight change from wc3.l introduces backtracking */
3 ws    [ \t]
4 nonws [^ \t\n]
5 word  {ws}*{nonws}+
6 words {word}{ws}+
8 %%
9         int cc = 0, wc = 0, lc = 0;
11 {word}{ws}*             cc += yyleng; ++wc;
12 {word}{ws}*\n           cc += yyleng; ++wc; ++lc;
13 {words}{word}           cc += yyleng; wc += 2;  /* oops */
14 {words}{2}{word}{ws}*   cc += yyleng; wc += 3;
15 {words}{3}{word}{ws}*   cc += yyleng; wc += 4;
17 {ws}+                   cc += yyleng;
19 \n+                     cc += yyleng; lc += yyleng;
21 <<EOF>>         {
22                 printf( "%8d %8d %8d\n", lc, wc, cc );
23                 yyterminate();
24                 }