From fd433aa285ff2b4f6270d6993d1b258ad48af36e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 12 Jul 2022 14:42:31 +0200 Subject: lexer: fix parsing with disabled block left stripping When a template was parsed with global block left stripping disabled, then any text preceding an expression or statement block start tag was incorrectly prepended to the first token value of the block, leading to syntax errors in the compiler. Signed-off-by: Jo-Philipp Wich --- tests/custom/04_bugs/40_lexer_bug_on_lstrip_off | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/custom/04_bugs/40_lexer_bug_on_lstrip_off (limited to 'tests') diff --git a/tests/custom/04_bugs/40_lexer_bug_on_lstrip_off b/tests/custom/04_bugs/40_lexer_bug_on_lstrip_off new file mode 100644 index 0000000..dc4f8dd --- /dev/null +++ b/tests/custom/04_bugs/40_lexer_bug_on_lstrip_off @@ -0,0 +1,20 @@ +When a template was parsed with global block left stripping disabled, +then any text preceding an expression or statement block start tag was +incorrectly prepended to the first token value of the block, leading +to syntax errors in the compiler. + +-- Testcase -- +{% for (let x in [1, 2, 3]): %} +{{ x }} +{% endfor %} +-- End -- + +-- Args -- +-Tno-lstrip +-- End -- + +-- Expect stdout -- +1 +2 +3 +-- End -- -- cgit v1.2.3