Start definining variable identifiers

Variables are standard identifiers or literals that can be
augmented by accessors (either dictionary or dot style). This
finally defines what a string is.
This commit is contained in:
Kevin Brown 2020-05-08 06:21:58 -04:00 committed by Kevin
parent ca3ecffd9a
commit 22764094bb
2 changed files with 29 additions and 3 deletions

View File

@ -68,7 +68,7 @@ block_parameter_value
variable_expression
=
variable_open IDENTIFIER { !variable_close variable_filter }* variable_close
variable_open variable_identifier { !variable_close variable_filter }* variable_close
;
variable_open
=
@ -79,6 +79,17 @@ variable_close
{SP}* @:"}}"
;
variable_identifier
=
( IDENTIFIER | STRING )
{ variable_accessor }*
;
variable_accessor
=
"[" variable_identifier "]"
;
variable_filter
=
{SP}* "|" {SP}* @:filter
@ -112,9 +123,24 @@ comment_content = {!comment_close CHAR}* ;
content = !(block_open | variable_open | comment_open) CHAR ;
STRING
=
SINGLE_QUOTE_STRING | DOUBLE_QUOTE_STRING
;
SINGLE_QUOTE_STRING
=
"'" { !"'" ?'.' }* "'"
;
DOUBLE_QUOTE_STRING
=
'"' { !'"' ?'.' }* '"'
;
IDENTIFIER
=
/[a-zA-Z][a-zA-Z0-9]*/
/[a-zA-Z_][a-zA-Z0-9_]*/
;
ALPHA

View File

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