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;
|
|
|
|
}
|