Support named parameters to calls

This also switches the parameters in calls to be returned as a
dictionary which should make it easier to differentiate between a
value-only parameter and a key-value parameter.
This commit is contained in:
Kevin Brown 2020-05-08 07:08:04 -04:00 committed by Kevin
parent 611bdcfcc4
commit 3480d1fa0e
2 changed files with 24 additions and 3 deletions

View File

@ -102,8 +102,29 @@ variable_accessor_call
variable_accessor_call_parameters
=
{SP}* @+:variable_identifier {SP}*
{ "," {SP}* @+:variable_identifier {SP}* }*
@+:variable_accessor_call_parameter
{ "," @+:variable_accessor_call_parameter }*
;
variable_accessor_call_parameter
=
variable_accessor_call_parameter_key_value
| variable_accessor_call_parameter_value_only
;
variable_accessor_call_parameter_key_value
=
{SP}* key:IDENTIFIER {SP}* "=" value:variable_accessor_call_parameter_value {SP}*
;
variable_accessor_call_parameter_value_only
=
value:variable_accessor_call_parameter_value
;
variable_accessor_call_parameter_value
=
{SP}* @:variable_identifier {SP}*
;
variable_accessor_dot

View File

@ -1,5 +1,5 @@
{% with key=val.test %}
{{ dict_var['single']["double"].dot |test(first ,second, third)|filter | lastFilter}}
{{ dict_var['single']["double"].dot |test(first ,second, named=third)|filter | lastFilter}}
{%block single key=val param=value %}
test {{var}}
{%endblock%}