This commit is contained in:
jacekpoz 2024-11-09 15:48:43 +01:00
parent 6c82163589
commit d68db68e6c
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -6,8 +6,18 @@
%x SINGLE_LINE %x SINGLE_LINE
%x MULTI_LINE %x MULTI_LINE
%x STRING
%x INCLUDE
%% %%
<INITIAL>"#include <" { ECHO; BEGIN(INCLUDE); }
<INCLUDE>">" { ECHO; BEGIN(INITIAL); }
<INITIAL>\" { ECHO; BEGIN(STRING); }
<STRING>\\\" { ECHO; }
<STRING>\" { ECHO; BEGIN(INITIAL); }
<STRING>. { ECHO; }
<INITIAL>"///"|"//!" { <INITIAL>"///"|"//!" {
if (leave_docs) { if (leave_docs) {
ECHO; ECHO;
@ -16,6 +26,8 @@
} }
} }
<INITIAL>"/**/" { putchar(' '); }
<INITIAL>"/**"|"/*!" { <INITIAL>"/**"|"/*!" {
if (leave_docs) { if (leave_docs) {
ECHO; ECHO;
@ -26,11 +38,12 @@
<INITIAL>"//" { BEGIN(SINGLE_LINE); } <INITIAL>"//" { BEGIN(SINGLE_LINE); }
<INITIAL>. { ECHO; } <INITIAL>. { ECHO; }
<SINGLE_LINE>"\\\n" { }
<SINGLE_LINE>\n { BEGIN(INITIAL); } <SINGLE_LINE>\n { BEGIN(INITIAL); }
<SINGLE_LINE>. { } <SINGLE_LINE>. { }
<INITIAL>"/*" { BEGIN(MULTI_LINE); } <INITIAL>"/*" { BEGIN(MULTI_LINE); }
<MULTI_LINE>"*/" { BEGIN(INITIAL); } <MULTI_LINE>"*/" { putchar(' '); BEGIN(INITIAL); }
<MULTI_LINE>. { } <MULTI_LINE>. { }
%% %%