wc1.l revision 1.1.1.1.26.1
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		}
20