source: trunk/essentials/sys-devel/flex/examples/fastwc/wc2.l

Last change on this file was 3031, checked in by bird, 18 years ago

flex 2.5.33.

File size: 370 bytes
Line 
1/* Somewhat faster "wc" tool: match more text with each rule */
2
3ws [ \t]
4nonws [^ \t\n]
5word {ws}*{nonws}+
6
7%option main noyywrap
8%%
9 int cc = 0, wc = 0, lc = 0;
10
11{word}{ws}* cc += yyleng; ++wc;
12{word}{ws}*\n cc += yyleng; ++wc; ++lc;
13
14{ws}+ cc += yyleng;
15
16\n+ cc += yyleng; lc += yyleng;
17
18<<EOF>> {
19 printf( "%8d %8d %8d\n", lc, wc, cc );
20 yyterminate();
21 }
Note: See TracBrowser for help on using the repository browser.