%option noreject
%option noyymore
%option noreject
%option noyymore
return strtol(Str, 0, 0);
}
return strtol(Str, 0, 0);
}
+static int CommentDepth = 0;
+
[ \t\n]+ { /* Ignore whitespace */ }
. { return Filetext[0]; }
[ \t\n]+ { /* Ignore whitespace */ }
. { return Filetext[0]; }
+
+
+"/*" { BEGIN(comment); CommentDepth++; }
+<comment>[^*/]* /* eat anything that's not a '*' or '/' */
+<comment>"*"+[^*/]* /* eat up '*'s not followed by '/'s */
+<comment>"/*" { ++CommentDepth; }
+<comment>"/"+[^*]* /* eat up /'s not followed by *'s */
+<comment>"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } }
+<comment><<EOF>> { fprintf(stderr, "Unterminated comment!\n"); abort(); }
+
%option noreject
%option noyymore
%option noreject
%option noyymore
return strtol(Str, 0, 0);
}
return strtol(Str, 0, 0);
}
+static int CommentDepth = 0;
+
[ \t\n]+ { /* Ignore whitespace */ }
. { return Filetext[0]; }
[ \t\n]+ { /* Ignore whitespace */ }
. { return Filetext[0]; }
+
+
+"/*" { BEGIN(comment); CommentDepth++; }
+<comment>[^*/]* /* eat anything that's not a '*' or '/' */
+<comment>"*"+[^*/]* /* eat up '*'s not followed by '/'s */
+<comment>"/*" { ++CommentDepth; }
+<comment>"/"+[^*]* /* eat up /'s not followed by *'s */
+<comment>"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } }
+<comment><<EOF>> { fprintf(stderr, "Unterminated comment!\n"); abort(); }
+