Skip to content

Commit

Permalink
Fix for square bracket identifiers breaking tests (#839)
Browse files Browse the repository at this point in the history
* Update tera.pest test rules

* Update mod.rs test rule parsing
  • Loading branch information
p-ackland authored May 27, 2024
1 parent 7f32cf9 commit 7b3942b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn parse_test(pair: Pair<Rule>) -> TeraResult<Test> {

for p in pair.into_inner() {
match p.as_rule() {
Rule::dotted_ident => ident = Some(p.as_str().to_string()),
Rule::dotted_square_bracket_ident => ident = Some(p.as_str().to_string()),
Rule::test_call => {
let (_name, _args) = parse_test_call(p)?;
name = Some(_name);
Expand Down
4 changes: 2 additions & 2 deletions src/parser/tera.pest
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ macro_call = { ident ~ "::" ~ ident ~ "(" ~ kwargs? ~ ")" }
test_arg = { logic_expr | array_filter }
test_args = _{ test_arg ~ ("," ~ test_arg)* }
test_call = !{ ident ~ ("(" ~ test_args ~ ")")? }
test_not = { dotted_ident ~ "is" ~ "not" ~ test_call }
test = { dotted_ident ~ "is" ~ test_call }
test_not = { dotted_square_bracket_ident ~ "is" ~ "not" ~ test_call }
test = { dotted_square_bracket_ident ~ "is" ~ test_call }

// -------------------------------------------------------

Expand Down

0 comments on commit 7b3942b

Please sign in to comment.