From 80cd1833a6ea84ac1630fb5dbea9a30c3cda5ff1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 21 May 2024 14:45:22 -0400 Subject: [PATCH] Support list literals for templates Because lists can be dynamic this needs to be handled in the grammar instead of in the lexer. --- grammar/JinjaGrammar.g4 | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- 2.47.2