User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions

→‎Order of operations: Translation code removal.
(→‎Order of operations: Translation code removal.)
Line 847:
== Order of operations ==
 
Operations are generally done left-to-right, but there is an order to which they are resolved.As soon as the filter fails one of the conditions, it will stop checking the rest of them (due to [[w:short-circuit evaluation|short-circuit evaluation]]) and move on to the next filter.The evaluation order is:
<translate>
<!--T:372-->
As soon as the filter fails one of the conditions, it will stop checking the rest of them (due to [[w:short-circuit evaluation|short-circuit evaluation]]) and move on to the next filter.</translate>
<translate>
<!--T:373-->
The evaluation order is:
</translate>
 
# <translate><!--T:374--> Anything surrounded by parentheses (<tvar|1><code>(</code></> and <tvar|2><code>)</code></>) is evaluated as a single unit.</translate>
# <translate><!--T:375--> Turning variables/literals into their respective data. (e.g., <tvar|1><code>page_namespace</code></> to 0)</translate>
# <translate><!--T:376--> Function calls (<tvar|1><code>norm</code></>, <tvar|2><code>lcase</code></>, etc.)</translate>
# <translate><!--T:377--> Unary <tvar|1><code>+</code></> and <tvar|2><code>-</code></> (defining positive or negative value, e.g. <tvar|3><code>-1234</code></>, <tvar|4><code>+1234</code></>)</translate>
# <translate><!--T:378--> Keywords</translate> (<translate><!--T:413--> <tvar|1><code>in</code></>, <tvar|2><code>rlike</code></>, etc.</translate>)
# <translate><!--T:379--> Boolean inversion</translate> (<code>!x</code>)
# <translate><!--T:380--> Exponentiation</translate> (<code>2**3 → 8</code>)
# <translate><!--T:381--> Multiplication-related (multiplication, division, modulo)</translate>
# <translate><!--T:382--> Addition and subtraction</translate> (<code>3-2 → 1</code>)
# <translate><!--T:383--> Comparisons.</translate> (<code><</code>, <code>></code>, <code>==</code>)
# <translate><!--T:384--> Boolean operations.</translate> (<code>&</code>, <code>|</code>, <code>^</code>)
 
=== Examples ===
 
* <translate><!--T:386--> <tvar|1><code>A & B | C</code></> is equivalent to <tvar|2><code>(A & B) | C</code></>, not to <tvar|3><code>A & (B | C)</code></>.</translate> <translate><!--T:387--> In particular, both <tvar|1><code>false & true '''| true'''</code></> and <tvar|2><code>false & false '''| true'''</code></> evaluates to <tvar|3><code>true</code></>.</translate>
* <translate><!--T:388--> <tvar|1><code>A | B & C</code></> is equivalent to <tvar|2><code>(A | B) & C</code></>, not to <tvar|3><code>A | (B & C)</code></>.</translate> <translate><!--T:389--> In particular, both <tvar|1><code>true | true '''& false'''</code></> and <tvar|2><code>true | false '''& false'''</code></> evaluates to <tvar|3><code>false</code></>.</translate>
 
== Condition counting ==
222

edits