diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-07-12 14:42:31 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-07-12 14:44:12 +0200 |
commit | fd433aa285ff2b4f6270d6993d1b258ad48af36e (patch) | |
tree | 527e07a1b032512497b3448c7e6be360de3c27ec /lexer.c | |
parent | 35c6b73c347caf45d74431890c1885ef58bfae24 (diff) |
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 <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r-- | lexer.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -887,9 +887,12 @@ lex_step(uc_lexer_t *lex, FILE *fp) buf_consume(lex, 1); } - /* global block lstrip */ - else if (lex->config && lex->config->lstrip_blocks) { - rv = lookbehind_to_text(lex, lex->source->off, TK_TEXT, " \t\v\f\r"); + /* put out text leading up to the opening tag and potentially + * strip trailing white space from it depending on the global + * block lstrip setting */ + else { + rv = lookbehind_to_text(lex, lex->source->off, TK_TEXT, + (lex->config && lex->config->lstrip_blocks) ? " \t\v\f\r" : NULL); } } else { |