From: Kevin Date: Tue, 21 May 2024 18:45:22 +0000 (-0400) Subject: Support list literals for templates X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80cd1833a6ea84ac1630fb5dbea9a30c3cda5ff1;p=thirdparty%2Fjinja.git Support list literals for templates Because lists can be dynamic this needs to be handled in the grammar instead of in the lexer. --- diff --git a/grammar/JinjaGrammar.g4 b/grammar/JinjaGrammar.g4 index eff36cd1..c0743b3a 100644 --- a/grammar/JinjaGrammar.g4 +++ b/grammar/JinjaGrammar.g4 @@ -12,8 +12,19 @@ expression expressions : expression*; +list_literal : LSQB SP? list_literal_values? SP? RSQB; +list_literal_values + : + (list_literal_value SP? COMMA SP?)* + list_literal_value + ; +list_literal_value + : STRING_LITERAL + ; + statement_include_template_list : STRING_LITERAL + | list_literal ; statement_include_context