Index: doc/user/06_feature/query/lang.html =================================================================== --- doc/user/06_feature/query/lang.html (revision 32031) +++ doc/user/06_feature/query/lang.html (revision 32032) @@ -82,21 +82,20 @@

Expressions and values

-An expression returns a value. A value can be: +An expression is evaluated to a value. A value can be:

A value is considered true if:

@@ -108,13 +107,13 @@ EXPR || EXPR logical OR (result: number) EXPR && EXPR logical AND (result: number) EXPR1 thus EXPR2 evaluate to EXPR2 if EXPR1 is true, else to void -EXPR + EXPR add (number only) -EXPR - EXPR subtract (number only) -EXPR * EXPR multiply or ... (number only) -EXPR / EXPR multiply or ... (number only) -EXPR == EXPR the two values are equal -EXPR != EXPR the two values are not equal -EXPR ~ string regex match left EXPR using pattern right string +EXPR + EXPR add (numbers only) +EXPR - EXPR subtract (numbers only) +EXPR * EXPR multiply (numbers only) +EXPR / EXPR divide (numbers only) +EXPR == EXPR the two values are equal (result: number) +EXPR != EXPR the two values are not equal (result: number) +EXPR ~ string regex match left EXPR using pattern right string (result: number) EXPR > EXPR left EXPR is greater than right EXPR (number only) EXPR >= EXPR left EXPR is greater than or equal to right EXPR (number only) EXPR < EXPR left EXPR is less than right EXPR (number only) @@ -131,11 +130,17 @@

-If the EXPR in an assert evaluates to false, a DRC violation is generated. +When running the DRC, if the EXPR in an assert evaluates to false, a +DRC violation is generated. The return value of such an expression should +normally be a list generated using the violation() function, so that it +can pass on all relevant details (such as expected value, affected objects) +to the DRC display. +

+When running a search, normally the result of an assert should be an object.

-If an assert EXPR is a list anywhere else than in a function argument, it is -evaluated for all valid members of the list (see P45, P46). For example +If an EXPR references a variable (list), it is evaluated for all +valid members of the list (see P45, P46), in order of the list. For example if there is a variable called FOO, which is a list of objects (built using a search statement), expression

@@ -162,6 +167,18 @@
 if FOO.p.clearance is smaller than 10 mil, the right size is not evaluated.
 See also: P45, P46.
 

+If a function needs to be called with a whole list passed instead of +calling to function for each element of the list, the special list() +built-in function should be used. For example assume FOO is a list of 5 +objects: +

+llen(list(FOO))
+
+

+will pass FOO as a list to function llen(), which is called only once. Without +the list() wrapping, llen() would be called five times, once for each item +in the list. +

A field reference is valid if the field exists. For example a line object has a thickness attribute, thus the .p.thickness is valid, but a polygon object does not have a thickness and .p.thickness on a polygon is invalid.