Skip to content

Instantly share code, notes, and snippets.

@fay59
Created March 14, 2017 21:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fay59/2ae80c1053dac67a9e487cb1d1d3c302 to your computer and use it in GitHub Desktop.
Save fay59/2ae80c1053dac67a9e487cb1d1d3c302 to your computer and use it in GitHub Desktop.
Tiny Flex lexer that skips C-style block comments
%option noyywrap
%x C_COMMENT
%%
"/*" { BEGIN(C_COMMENT); }
<C_COMMENT>"*/" { BEGIN(INITIAL); }
<C_COMMENT>. { }
<C_COMMENT>\n { }
. { printf("%s", yytext); }
%%
int main() {
yylex();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment