Skip to content

Commit

Permalink
allow chaining of tests with other logic
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Jul 29, 2024
1 parent 876ad4f commit 89b93e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resources/syntax/Twig.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ contexts:
tests_body:
- meta_scope: meta.function.test.twig
- include: block_pop
- match: (?=\b(and|or|b-and|b-or|b-xor)\b)
pop: 1
# builtin tests
- match: '\bnot\b'
scope: keyword.operator.word.logical.twig
Expand Down
13 changes: 13 additions & 0 deletions resources/syntax/tests/syntax_test_html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,19 @@
| ^^^ support.function.test.twig
| ^^ punctuation.definition.expression.end.twig

{{ name is odd and name != '' }}
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.expression.twig
|^ punctuation.definition.expression.begin.twig
| ^ - variable.function.test.twig

{% if loop.index is divisible by(3) and foo == bar %}{% endif %}
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.twig
| ^^ keyword.operator.comparison.test.twig
| ^^^^^^^^^^^^ support.function.test.twig
| ^^^ meta.function-call.arguments.twig
| ^ constant.numeric.value.twig
| ^^^ variable.other.twig

{# Custom test #}
{{ name is weird }}
| ^^ keyword.operator.comparison.test.twig
Expand Down

0 comments on commit 89b93e2

Please sign in to comment.