1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
{% set a = 4 %}
{{ a == 4 }}
{{ b != c }}
{{ c < d }}
{{ d <= e }}
{{ e > f }}
{{ f >= g }}
{{ g + h }}
{{ h - i }}
{{ i ~ j }}
{{ j * k }}
{{ k ** l }}
{{ l / m }}
{{ m // n }}
{{ n % o }}
{{ o|default('foo') }}
{{ p ? q : r }}
{{ s ?: t }}
{% if a and b or not c %}
{% for p in foo %}
{% if d b-and e and f b-xor g or h b-or i %}
{% if j starts with 'h' %}
{% if i ends with 'j' %}
{% if k is same as false %}
{% if l matches '/f[o]{2,}(?:bar)?' %}
----------------------------------------------------
[
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "set"]]],
["property", "a"], ["operator", "="], ["number", "4"],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "a"], ["operator", "=="], ["number", "4"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "b"], ["operator", "!="], ["property", "c"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "c"], ["operator", "<"], ["property", "d"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "d"], ["operator", "<="], ["property", "e"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "e"], ["operator", ">"], ["property", "f"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "f"], ["operator", ">="], ["property", "g"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "g"], ["operator", "+"], ["property", "h"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "h"], ["operator", "-"], ["property", "i"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "i"], ["operator", "~"], ["property", "j"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "j"], ["operator", "*"], ["property", "k"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "k"], ["operator", "**"], ["property", "l"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "l"], ["operator", "/"], ["property", "m"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "m"], ["operator", "//"], ["property", "n"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "n"], ["operator", "%"], ["property", "o"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "o"],
["operator", "|"],
["property", "default"],
["punctuation", "("],
["string", [["punctuation", "'"], "foo", ["punctuation", "'"]]],
["punctuation", ")"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "p"], ["operator", "?"],
["property", "q"], ["punctuation", ":"],
["property", "r"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{{"]]],
["property", "s"], ["operator", "?:"], ["property", "t"],
["rd", [["punctuation", "}}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "if"]]],
["property", "a"], ["operator", "and"], ["property", "b"],
["operator", "or"], ["operator", "not"], ["property", "c"],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "for"]]],
["property", "p"], ["operator", "in"], ["property", "foo"],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "if"]]],
["property", "d"], ["operator", "b-and"],
["property", "e"], ["operator", "and"],
["property", "f"], ["operator", "b-xor"],
["property", "g"], ["operator", "or"],
["property", "h"], ["operator", "b-or"],
["property", "i"],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "if"]]],
["property", "j"],
["operator", "starts with"],
["string", [["punctuation", "'"], "h", ["punctuation", "'"]]],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "if"]]],
["property", "i"],
["operator", "ends with"],
["string", [["punctuation", "'"], "j", ["punctuation", "'"]]],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "if"]]],
["property", "k"], ["operator", "is"],
["operator", "same as"], ["boolean", "false"],
["rd", [["punctuation", "%}"]]]
]],
["tag", [
["ld", [["punctuation", "{%"], ["keyword", "if"]]],
["property", "l"], ["operator", "matches"],
["string", [["punctuation", "'"], "/f[o]{2,}(?:bar)?", ["punctuation", "'"]]],
["rd", [["punctuation", "%}"]]]
]]
]
----------------------------------------------------
Checks for operators.