about summary refs log tree commit diff
path: root/Doc/Zsh/arith.yo
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-06-12 13:45:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-06-12 13:45:04 +0000
commit8a4af211c346fd00ded0bb1b1384ca1514ed84e0 (patch)
tree50d303b3dfe084ab5d660d2e17eed0646ab5a277 /Doc/Zsh/arith.yo
parentc17b4c8d77c7a2ec52168f471a262023ed2e437d (diff)
downloadzsh-8a4af211c346fd00ded0bb1b1384ca1514ed84e0.tar.gz
zsh-8a4af211c346fd00ded0bb1b1384ca1514ed84e0.tar.xz
zsh-8a4af211c346fd00ded0bb1b1384ca1514ed84e0.zip
25149: add C_PRECEDENCES option to make arithmetic have C/Perl precedence
Diffstat (limited to 'Doc/Zsh/arith.yo')
-rw-r--r--Doc/Zsh/arith.yo27
1 files changed, 25 insertions, 2 deletions
diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo
index d7f1ae608..423e6c1bc 100644
--- a/Doc/Zsh/arith.yo
+++ b/Doc/Zsh/arith.yo
@@ -91,8 +91,8 @@ taken for a parameter name.
 
 cindex(arithmetic operators)
 cindex(operators, arithmetic)
-An arithmetic expression uses nearly the same syntax, precedence, and
-associativity of expressions in C.
+An arithmetic expression uses nearly the same syntax and
+associativity of expressions as in C.
 The following operators are supported (listed in decreasing order
 of precedence):
 
@@ -119,6 +119,29 @@ short-circuiting, and only one of the latter two expressions in a ternary
 operator is evaluated.  Note the precedence of the bitwise AND, OR,
 and XOR operators.
 
+With the option tt(C_PRECEDENCES) the precedences (but no other
+properties) of the operators are altered to be the same as those in
+most other languages that support the relevant operators:
+
+startsitem()
+sitem(tt(PLUS() - ! ~ PLUS()PLUS() --))(unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement)
+sitem(tt(**))(exponentiation)
+sitem(tt(* / %))(multiplication, division, modulus (remainder))
+sitem(tt(PLUS() -))(addition, subtraction)
+sitem(tt(<< >>))(bitwise shift left, right)
+sitem(tt(< > <= >=))(comparison)
+sitem(tt(== !=))(equality and inequality)
+sitem(tt(&))(bitwise AND)
+sitem(tt(^))(bitwise XOR)
+sitem(tt(|))(bitwise OR)
+sitem(tt(&&))(logical AND)
+sitem(tt(^^))(logical XOR)
+sitem(tt(||))(logical OR)
+sitem(tt(? :))(ternary operator)
+sitem(tt(= PLUS()= -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= **=))(assignment)
+sitem(tt(,))(comma operator)
+endsitem()
+
 cindex(mathematical functions, use of)
 cindex(functions, math, use of)
 Mathematical functions can be called with the syntax