help/en/hlp_eval.txt
changeset 1 320e4393785a
parent 0 7707b26e82fd
child 4 faaed3ae3fa8
equal deleted inserted replaced
0:7707b26e82fd 1:320e4393785a
     2  /EVAL [expression]
     2  /EVAL [expression]
     3 
     3 
     4 Evaluates expression and executes result string as command.
     4 Evaluates expression and executes result string as command.
     5 Expression evaluation rules:
     5 Expression evaluation rules:
     6 * all operators have the same precedence;
     6 * all operators have the same precedence;
     7 * parenthesis searching will not take into account strings;
       
     8 * supported operators:
     7 * supported operators:
     9   . string concatenation
     8   . string concatenation
    10   + binary plus / string concatenation
     9   + binary plus / string concatenation
    11   - binary minus
    10   - binary minus
    12   * multiplication / string replication
    11   * multiplication / string replication
    18 * strings must be quoted with double quotes ("..."), within string backslash is used for character escaping (\\ and \" are only useful applications);
    17 * strings must be quoted with double quotes ("..."), within string backslash is used for character escaping (\\ and \" are only useful applications);
    19 * parentheses can be used to change operators precedence, nested parentheses are supported as long as they are balanced;
    18 * parentheses can be used to change operators precedence, nested parentheses are supported as long as they are balanced;
    20 * numbers can be specified as plain decimal numbers, minus in front of digit will be recognized as a part of number;
    19 * numbers can be specified as plain decimal numbers, minus in front of digit will be recognized as a part of number;
    21 * mcabber variables can be specified by name, though only subset of possible names is suppoted:
    20 * mcabber variables can be specified by name, though only subset of possible names is suppoted:
    22   - variable must start from latin alphabetic symbol;
    21   - variable must start from latin alphabetic symbol;
    23   - inside of variable name also are allowed digits, - and _.
    22   - inside of variable name also are allowed digits, - and _;
       
    23 * to enable parentheses in character strings current implementation ignores anything after extra closing paren - you may use this as a sort of comment...
    24 
    24 
    25 Example:
    25 Example:
    26  /eval "echo 2 + 2 = " . (2+2)
    26  /eval "echo 2 + 2 = " . (2+2)
    27  /eval "set ping_interval = " . (ping_interval + 1)
    27  /eval "set ping_interval = " . (ping_interval + 1)    ) this example probably should use /let command.
    28 Note: last example probably should use /let command.