From 02629b84de23bdc5896ac4b357e2f16dfb3996ec Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 29 Apr 2021 17:59:40 +0200 Subject: lexer: fix infinite loop on parsing unterminated comments Signed-off-by: Jo-Philipp Wich --- .../custom/03_bugs/18_hang_on_line_comments_at_eof | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/custom/03_bugs/18_hang_on_line_comments_at_eof (limited to 'tests/custom') diff --git a/tests/custom/03_bugs/18_hang_on_line_comments_at_eof b/tests/custom/03_bugs/18_hang_on_line_comments_at_eof new file mode 100644 index 0000000..957ed47 --- /dev/null +++ b/tests/custom/03_bugs/18_hang_on_line_comments_at_eof @@ -0,0 +1,31 @@ +When parsing a comment near EOF, or a comment escaping the end +of an expression block, the lexer did end up in an infinite loop. + +-- Expect stderr -- +Syntax error: Expecting expression +In line 1, byte 9: + + `{{ // }}` + ^-- Near here + + +-- End -- + +-- Testcase -- +{{ // }} +-- End -- + + +-- Expect stderr -- +Syntax error: Unterminated comment +In line 1, byte 4: + + `{{ /* }}` + ^-- Near here + + +-- End -- + +-- Testcase -- +{{ /* }} +-- End -- -- cgit v1.2.3