diff --git a/l2/2.lex b/l2/2.lex index e85f7b7..0e5cfa4 100644 --- a/l2/2.lex +++ b/l2/2.lex @@ -1,11 +1,16 @@ %x COMMENT +%x STRING %% -"--" { BEGIN(COMMENT); } -"\n" { ECHO; BEGIN(INITIAL); } +"--" { BEGIN(COMMENT); } +\" { ECHO; BEGIN(STRING); } +"\n" { ECHO; BEGIN(INITIAL); } +\\\" { ECHO; } +\" { ECHO; BEGIN(INITIAL); } -. { ECHO; } -. { } +. { ECHO; } +. { } +. { ECHO; } %% // https://westes.github.io/flex/manual/Start-Conditions.html