Fix content overtaking expressions

This fixes a issue where content would try to overtake everything
following it, even if there was a better expression to match after
the content. This was fixed by telling content to match everything
but the start of different expressions, which appears to solve a
bunch of issues.
This commit is contained in:
Kevin Brown 2020-05-08 05:33:28 -04:00 committed by Kevin
parent db4ad51426
commit 8bebf88507
2 changed files with 14 additions and 14 deletions

View File

@ -1,17 +1,17 @@
start
=
expression
expressions
$
;
expressions
=
{expression}*
;
expression
=
{ !matching_expression CHAR }* &matching_expression
;
matching_expression
=
raw_block_expression | block_expression | variable_expression | comment_expression
content | raw_block_expression | block_expression | variable_expression | comment_expression
;
raw_block_expression
@ -28,8 +28,8 @@ raw_block_end
block_expression
=
block_start {SP}* expression {SP}* block_end
#| block_start
block_start {SP}* expressions {SP}* block_end
| block_start
;
block_start
@ -80,14 +80,14 @@ variable_filter
;
filter = @+:IDENTIFIER [@+:filter_parameters];
filter_parameters = "(" [@+:filter_parameter {"," {SP}* @+:filter_parameter}*] ")";
filter_parameter = {CHAR}* ;
filter_parameter = {!"," !")" CHAR}* ;
comment_expression = comment_open comment comment_close ;
comment_open = "{#" ;
comment_close = "#}" ;
comment = {!comment_close CHAR}* ;
content = {CHAR}* ;
content = !("{%" | "{{" | "{#") CHAR ;
IDENTIFIER
=

View File

@ -1,8 +1,8 @@
{% with key=val %}
{{ kkk |test(first,second, third)|filter}}
{%block single key=val param=value %}
test {{var}}
{%endblock%}
{# comment contents
across lines #}
{% raw %}
{% block %}fake content{{ fake vars }}
{% endraw %}
{% raw %}{% block %}fake content{{ fake vars }}{% endraw %}