aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-21 17:23:37 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:46:29 +0800
commit1dbbb7aa1833505a692f8c506fcd5ee0b54314d1 (patch)
tree15f12252abc710e3641f2dbaa5ecd0d6ea633cf1
parentParser: support == in arithmetic comparison (diff)
downloadlibbash-1dbbb7aa1833505a692f8c506fcd5ee0b54314d1.tar.gz
libbash-1dbbb7aa1833505a692f8c506fcd5ee0b54314d1.tar.bz2
libbash-1dbbb7aa1833505a692f8c506fcd5ee0b54314d1.zip
Walker: support == in arithmetic comparison
-rw-r--r--bashast/libbashWalker.g1
-rw-r--r--scripts/binary_arithmetic.bash2
2 files changed, 3 insertions, 0 deletions
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g
index c8962fd..2ee887c 100644
--- a/bashast/libbashWalker.g
+++ b/bashast/libbashWalker.g
@@ -1084,6 +1084,7 @@ arithmetics returns[long value]
|^(LESS_THAN l=arithmetics r=arithmetics) { $value = l < r; }
|^(GREATER_THAN l=arithmetics r=arithmetics) { $value = l > r; }
|^(NOT_EQUALS l=arithmetics r=arithmetics) { $value = l != r; }
+ |^(EQUALS_TO l=arithmetics r=arithmetics) { $value = l == r; }
|^(LSHIFT l=arithmetics r=arithmetics) { $value = l << r; }
|^(RSHIFT l=arithmetics r=arithmetics) { $value = l >> r; }
|^(PLUS l=arithmetics r=arithmetics) { $value = l + r; }
diff --git a/scripts/binary_arithmetic.bash b/scripts/binary_arithmetic.bash
index 36b4c9d..cac471f 100644
--- a/scripts/binary_arithmetic.bash
+++ b/scripts/binary_arithmetic.bash
@@ -67,3 +67,5 @@ ARRAY=(1 2 3 4 5)
FOO059="$((100**0))"
echo "$((FOO059||FOO059++))"
echo "$((0&&FOO059++))"
+echo "$(( 1 == 2))"
+echo "$(( 1 == 1))"