jftt/l2/2.lex

25 lines
449 B
Text

%x COMMENT
%x STRING
%%
<INITIAL>"--" { BEGIN(COMMENT); }
<INITIAL>\" { ECHO; BEGIN(STRING); }
<COMMENT>"\n" { ECHO; BEGIN(INITIAL); }
<STRING>\\\" { ECHO; }
<STRING>\" { ECHO; BEGIN(INITIAL); }
<INITIAL>. { ECHO; }
<COMMENT>. { }
<STRING>. { ECHO; }
%%
// https://westes.github.io/flex/manual/Start-Conditions.html
#include <stdlib.h>
int main(void) {
yylex();
return EXIT_SUCCESS;
}