Skip to content

Instantly share code, notes, and snippets.

@mbenke mbenke/gist:706400
Created Nov 19, 2010

Embed
What would you like to do?
cid.l
%option noyywrap
D [0-9]
L [A-Za-z_]
%start COMMENT
%{
int depth = 0;
%}
%%
ifdef
ifndef
define
undef
include
extern
class
static
if
then
else
while
do
for
return
<INITIAL>"/*" {depth=1;BEGIN(COMMENT);}
<COMMENT>"/*" {depth++;}
<COMMENT>"*/" {depth--;
if(!depth)
BEGIN(INITIAL);
}
<COMMENT>. {}
<INITIAL>{L}({D}|{L})* { return 1; }
.
\n
%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.