]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Restrict where conditional expressions are allowed
authorKevin <kevin@kevin-brown.com>
Tue, 12 May 2020 01:05:37 +0000 (21:05 -0400)
committerKevin <kevin@kevin-brown.com>
Tue, 12 May 2020 01:07:58 +0000 (21:07 -0400)
Previously conditional expressions were only allowed in things which
accepted parameters to call accessors, which is most things, but this
was found to be too broad. Many contexts to not actually allow conditional
expressions so this was restricted back to block parameters and variable
calls.

grammar.ebnf

index 0619ac1cbd01f3d7d1a71c29880880c2762b45c6..beaf0d3849144c43dbe43085af676e3dc2aeb659 100644 (file)
@@ -129,11 +129,12 @@ block_parameter_value_only
     | value:implicit_identifier_tuple\r
     | value:variable_identifier_with_alias\r
     | value:variable_accessor_call_parameter_value\r
+    | value:conditional_expression\r
     ;\r
 \r
 variable_expression\r
     =\r
-    variable_open type:`variable` name:variable_identifier variable_close\r
+    variable_open type:`variable` name:( conditional_expression | variable_identifier ) variable_close\r
     ;\r
 variable_open\r
     =\r
@@ -212,8 +213,7 @@ variable_accessor_call_parameter_key
 \r
 variable_accessor_call_parameter_value\r
     =\r
-    | conditional_expression\r
-    | variable_identifier\r
+    conditional_expression\r
     ;\r
 \r
 conditional_expression\r