From 004ee2527301ed4356c9a79d4eb43f438bc63e94 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 15 Mar 2024 08:35:17 +0200 Subject: [PATCH] Make comments greedy This allows having multiple comments --- 02_syntax/lexer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02_syntax/lexer.py b/02_syntax/lexer.py index 46e7cbf..3274be1 100644 --- a/02_syntax/lexer.py +++ b/02_syntax/lexer.py @@ -49,7 +49,7 @@ def t_whitespace(t): t.lexer.lineno += t.value.count('\n') def t_comment(t): - r'\(%(.|\n)*%\)' + r'\(%(.|\n)*?%\)' t.lexer.lineno += t.value.count('\n') t_LPAREN = r'\('