Skip to content

Commit

Permalink
Support apply tag with call_expression
Browse files Browse the repository at this point in the history
closes #51
  • Loading branch information
moetelo committed Nov 16, 2024
1 parent e4345fb commit b88c97b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/tree-sitter-twig/corpus/statements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ Apply
(source_elements
(content))))

==================
Apply call expression
==================
{% apply niceComicSans('issue 51') %}
{% endapply %}
---
(template
(apply
(call_expression
(function)
(arguments
(string)))))

==================
Apply multiple filters
==================
Expand Down
6 changes: 5 additions & 1 deletion packages/tree-sitter-twig/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@ module.exports = grammar({
alias('apply', 'keyword'),
field(
'filter',
choice(alias($.identifier, $.function), $.filter_expression),
choice(
alias($.identifier, $.function),
$.filter_expression,
$.call_expression,
),
),
source_elements($),
alias('endapply', 'keyword'),
Expand Down

0 comments on commit b88c97b

Please sign in to comment.