source:
trunk/essentials/sys-devel/flex/examples/fastwc/wc1.l
Last change on this file was 3031, checked in by , 18 years ago | |
---|---|
File size: 269 bytes |
Line | |
---|---|
1 | /* First cut at a flex-based "wc" tool. */ |
2 | |
3 | ws [ \t] |
4 | nonws [^ \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.