?? example2.l
字號:
%{
int comments, code, whiteSpace;
%}
%s COMMENT
%%
^[ \t]*"/*" { BEGIN COMMENT; /* enter comment eating state */ }
^[ \t]*"/*".*"*/"[ \t]*\n {
comments++; /* self-contained comment */
}
<COMMENT>"*/"[ \t]*\n { BEGIN 0; comments++;}
<COMMENT>"*/" { BEGIN 0; }
<COMMENT>\n { comments++; }
<COMMENT>.\n { comments++; }
^[ \t]*\n { whiteSpace++; }
.+"/*".*"*/".*\n { code++; comments++; }
.*"/*".*"*/".+\n { code++; }
.+"/*".*\n { code++; BEGIN COMMENT; }
.\n { code++; }
. ; /* ignore everything else */
%%
main()
{
yylex();
printf("code: %d, comments %d, white space %d\n",
code, comments, whiteSpace);
}
int yywrap()
{return 1;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -