jftt/l2/2.lex

26 lines
449 B
Text
Raw Normal View History

2024-11-03 22:05:19 +01:00
%x COMMENT
2024-11-04 09:16:29 +01:00
%x STRING
2024-11-03 22:05:19 +01:00
%%
2024-11-04 09:16:29 +01:00
<INITIAL>"--" { BEGIN(COMMENT); }
<INITIAL>\" { ECHO; BEGIN(STRING); }
<COMMENT>"\n" { ECHO; BEGIN(INITIAL); }
<STRING>\\\" { ECHO; }
<STRING>\" { ECHO; BEGIN(INITIAL); }
2024-11-03 22:05:19 +01:00
2024-11-04 09:16:29 +01:00
<INITIAL>. { ECHO; }
<COMMENT>. { }
<STRING>. { ECHO; }
2024-11-03 22:05:19 +01:00
%%
// https://westes.github.io/flex/manual/Start-Conditions.html
#include <stdlib.h>
int main(void) {
yylex();
return EXIT_SUCCESS;
}