From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, src/core/, bashast/
Date: Thu, 9 Jun 2011 08:15:46 +0000 (UTC) [thread overview]
Message-ID: <17556b103a2817bfacb4a838f07e8d3738caed8d.betelgeuse@gentoo> (raw)
commit: 17556b103a2817bfacb4a838f07e8d3738caed8d
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 4 10:20:04 2011 +0000
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Thu Jun 9 08:39:00 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=17556b10
Walker: support != in arithmetic expansion
---
bashast/libbashWalker.g | 1 +
scripts/arithmetic_assignment.bash | 1 +
scripts/arithmetic_assignment.bash.result | 1 +
src/core/interpreter.h | 9 +++++++++
4 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g
index 8263b15..e793f56 100644
--- a/bashast/libbashWalker.g
+++ b/bashast/libbashWalker.g
@@ -903,6 +903,7 @@ arithmetics returns[int value]
|^(GEQ l=arithmetics r=arithmetics) { $value = walker->greater_equal_than(l, r); }
|^(LESS_THAN l=arithmetics r=arithmetics) { $value = walker->less_than(l, r); }
|^(GREATER_THAN l=arithmetics r=arithmetics) { $value = walker->greater_than(l, r); }
+ |^(NOT_EQUALS l=arithmetics r=arithmetics) { $value = walker->not_equal_to(l, r); }
|^(LSHIFT l=arithmetics r=arithmetics) { $value = walker->left_shift(l, r); }
|^(RSHIFT l=arithmetics r=arithmetics) { $value = walker->right_shift(l, r); }
|^(PLUS l=arithmetics r=arithmetics) { $value = walker->plus(l, r); }
diff --git a/scripts/arithmetic_assignment.bash b/scripts/arithmetic_assignment.bash
index f1f40f6..c53758c 100644
--- a/scripts/arithmetic_assignment.bash
+++ b/scripts/arithmetic_assignment.bash
@@ -11,5 +11,6 @@ FOO009="$((value^=5))"
FOO010="$((value|=10))"
FOO011=("CREATED" 2)
FOO012="$((${FOO011[0]}=10))"
+FOO013="$((3!=5))"
value=100
let "value=${value}"
diff --git a/scripts/arithmetic_assignment.bash.result b/scripts/arithmetic_assignment.bash.result
index 9f47242..d5e6ea4 100644
--- a/scripts/arithmetic_assignment.bash.result
+++ b/scripts/arithmetic_assignment.bash.result
@@ -11,4 +11,5 @@ FOO009=5
FOO010=15
FOO011=CREATED 2
FOO012=10
+FOO013=1
value=100
diff --git a/src/core/interpreter.h b/src/core/interpreter.h
index 2c138e5..39fcadf 100644
--- a/src/core/interpreter.h
+++ b/src/core/interpreter.h
@@ -267,6 +267,15 @@ public:
return left > right;
}
+ /// \brief perform not equal to
+ /// \param the first operand
+ /// \param the second operand
+ /// \return the calculated result
+ static int not_equal_to(int left, int right)
+ {
+ return left != right;
+ }
+
/// \brief perform left shift
/// \param the first operand
/// \param the second operand
next reply other threads:[~2011-06-09 8:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 8:15 Petteri Räty [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-08-19 14:54 [gentoo-commits] proj/libbash:master commit in: scripts/, src/core/, bashast/ Petteri Räty
2011-08-04 13:53 Petteri Räty
2011-06-03 14:48 Petteri Räty
2011-05-15 11:19 Petteri Räty
2011-05-11 7:19 Petteri Räty
2011-05-07 12:25 Petteri Räty
2011-04-20 14:04 Petteri Räty
2011-04-20 14:04 Petteri Räty
2011-04-20 14:04 Petteri Räty
2011-04-14 4:50 Petteri Räty
2011-04-06 15:07 Petteri Räty
2011-04-06 7:43 Petteri Räty
2011-04-04 16:09 Petteri Räty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17556b103a2817bfacb4a838f07e8d3738caed8d.betelgeuse@gentoo \
--to=betelgeuse@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox