mirror of
https://github.com/westes/flex.git
synced 2026-01-27 01:44:23 +00:00
17 lines
291 B
Plaintext
17 lines
291 B
Plaintext
/* basic example - non-reentrant version */
|
|
%{
|
|
int num_lines = 0, num_chars = 0;
|
|
%}
|
|
%option noyywrap
|
|
%%
|
|
\n ++num_lines; ++num_chars;
|
|
. ++num_chars;
|
|
|
|
%%
|
|
|
|
int main() {
|
|
yylex();
|
|
printf( "# of lines = %d, # of chars = %d\n",
|
|
num_lines, num_chars );
|
|
}
|