home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 6
/
FreshFish_September1994.bin
/
bbs
/
gnu
/
flex-2.4.7-src.lha
/
GNU
/
src
/
amiga
/
flex-2.4.7
/
MISC
/
fastwc
/
wc2.l
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS
UTF-8
Wrap
Text File
|
1993-07-23
|
348 b
|
21 lines
/* Somewhat faster "wc" tool: match more text with each rule */
ws [ \t]
nonws [^ \t\n]
word {ws}*{nonws}+
%%
int cc = 0, wc = 0, lc = 0;
{word}{ws}* cc += yyleng; ++wc;
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
{ws}+ cc += yyleng;
\n+ cc += yyleng; lc += yyleng;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}