User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions
Content added Content deleted
(→Order of operations: Translation code removal.) |
|||
Line 847: | Line 847: | ||
== Order of operations == |
== Order of operations == |
||
Operations are generally done left-to-right, but there is an order to which they are resolved. |
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> |
|||
# |
#Anything surrounded by parentheses (<code>(</code> and <code>)</code>) is evaluated as a single unit. |
||
# |
#Turning variables/literals into their respective data. (e.g.,<code>page_namespace</code> to 0) |
||
# |
#Function calls (<code>norm</code>,<code>lcase</code>, etc.) |
||
# |
#Unary <code>+</code> and <code>-</code> (defining positive or negative value, e.g.<code>-1234</code>, <code>+1234</code>) |
||
# |
#Keywords (<code>in</code>, <code>rlike</code>, etc.) |
||
# |
#Boolean inversion (<code>!x</code>) |
||
# |
#Exponentiation (<code>2**3 → 8</code>) |
||
# |
#Multiplication-related (multiplication, division, modulo) |
||
# |
#Addition and subtraction (<code>3-2 → 1</code>) |
||
# |
#Comparisons. (<code><</code>, <code>></code>, <code>==</code>) |
||
# |
#Boolean operations. (<code>&</code>, <code>|</code>, <code>^</code>) |
||
=== Examples === |
=== Examples === |
||
* |
*<code>A & B | C</code> is equivalent to <code>(A & B) | C</code>, not to <code>A & (B | C)</code>.In particular, both <code>false & true '''| true'''</code> and <code>false & false '''| true'''</code> evaluates to <code>true</code>. |
||
* |
*<code>A | B & C</code> is equivalent to <code>(A | B) & C</code>, not to <code>A | (B & C)</code>.In particular, both <code>true | true '''& false'''</code> and <code>true | false '''& false'''</code> evaluates to <code>false</code>. |
||
== Condition counting == |
== Condition counting == |