diff options
Diffstat (limited to 'WebKitTools/android/flex-2.5.4a/MISC/fastwc/wc1.l')
-rw-r--r-- | WebKitTools/android/flex-2.5.4a/MISC/fastwc/wc1.l | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/WebKitTools/android/flex-2.5.4a/MISC/fastwc/wc1.l b/WebKitTools/android/flex-2.5.4a/MISC/fastwc/wc1.l new file mode 100644 index 0000000..d6696bc --- /dev/null +++ b/WebKitTools/android/flex-2.5.4a/MISC/fastwc/wc1.l @@ -0,0 +1,18 @@ +/* First cut at a flex-based "wc" tool. */ + +ws [ \t] +nonws [^ \t\n] + +%% + int cc = 0, wc = 0, lc = 0; + +{nonws}+ cc += yyleng; ++wc; + +{ws}+ cc += yyleng; + +\n ++lc; ++cc; + +<<EOF>> { + printf( "%8d %8d %8d\n", lc, wc, cc ); + yyterminate(); + } |