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

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

flex 2.5.33.

File size: 269 bytes
Line 
1/* First cut at a flex-based "wc" tool. */
2
3ws [ \t]
4nonws [^ \t\n]
5
6%option main noyywrap
7%%
8 int cc = 0, wc = 0, lc = 0;
9
10{nonws}+ cc += yyleng; ++wc;
11
12{ws}+ cc += yyleng;
13
14\n ++lc; ++cc;
15
16<<EOF>> {
17 printf( "%8d %8d %8d\n", lc, wc, cc );
18 yyterminate();
19 }
Note: See TracBrowser for help on using the repository browser.