From: Kevin Brown Date: Sat, 16 May 2020 02:27:06 +0000 (-0400) Subject: Do not require a newline before line statements X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f11698df16baf9d896fd15e698a7a1f9aa5a0384;p=thirdparty%2Fjinja.git Do not require a newline before line statements As we discovered in the tests, the logic for line statements only enforces that when they are found, the remaining portion of the line is treated as a statement declaration. This means that a line statement can follow things such as text, which the grammar did not previously allow. The grammar also did not allow a line statement to be the first line in a file, wich this change also now supports. All non-newline whitespace preceding the line statement will continue to be stripped. --- diff --git a/grammar.ebnf b/grammar.ebnf index 039d57fb..d68dbb20 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -115,7 +115,7 @@ line_block_end line_block_open = - "\n" {SP}* line_block_open_symbol {SP}* + { !"\n" SP }* line_block_open_symbol { !"\n" SP }* ; line_block_open_symbol