From d68db68e6c996cbd4dc2673d55dedfda3fa55f5a Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Sat, 9 Nov 2024 15:48:43 +0100 Subject: [PATCH] fix l2/3 --- l2/3.lex | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/l2/3.lex b/l2/3.lex index 5a6d260..192279d 100644 --- a/l2/3.lex +++ b/l2/3.lex @@ -6,8 +6,18 @@ %x SINGLE_LINE %x MULTI_LINE +%x STRING +%x INCLUDE %% +"#include <" { ECHO; BEGIN(INCLUDE); } +">" { ECHO; BEGIN(INITIAL); } + +\" { ECHO; BEGIN(STRING); } +\\\" { ECHO; } +\" { ECHO; BEGIN(INITIAL); } +. { ECHO; } + "///"|"//!" { if (leave_docs) { ECHO; @@ -16,6 +26,8 @@ } } +"/**/" { putchar(' '); } + "/**"|"/*!" { if (leave_docs) { ECHO; @@ -26,11 +38,12 @@ "//" { BEGIN(SINGLE_LINE); } . { ECHO; } +"\\\n" { } \n { BEGIN(INITIAL); } . { } "/*" { BEGIN(MULTI_LINE); } -"*/" { BEGIN(INITIAL); } +"*/" { putchar(' '); BEGIN(INITIAL); } . { } %%