VirusTotal / yara

The pattern matching swiss knife
https://virustotal.github.io/yara/
BSD 3-Clause "New" or "Revised" License
8.26k stars 1.44k forks source link

Confusing documentation of "for .. of". #1898

Closed GWHAYWOOD closed 1 year ago

GWHAYWOOD commented 1 year ago

In the documentation at https://yara.readthedocs.io/en/stable/writingrules.html#conditions, in the section "Applying the same condition to many strings", the "for..of" operator is introduced.

In that section and the following section "Using anonymous strings with of and for..of" the same wording is used, but in the next section "Iterating over string occurrences" the expressions use the word "in" instead of the word "of". Here are some examples:

for all i in (1,2,3) : ( @a[i] + 10 == @b[i] ) for all i in (1..3) : ( @a[i] + 10 == @b[i] ) for all i in (1..#a) : ( @a[i] < 100 ) for any i in (1..#a) : ( @a[i] < 100 ) for 2 i in (1..#a) : ( @a[i] < 100 )

"In summary, the syntax of this operator is: for expression identifier in indexes : ( boolean_expression )"

And one final, delicious example:

"In general the for..of operator has the form: for in : ( )"

This is confusing. If the 'in' keyword may replace of the 'of' keyword this should be explicitly stated.

See also #1766 for other documentation issues.