From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QOsw9-00082g-I4 for garchives@archives.gentoo.org; Tue, 24 May 2011 14:50:23 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6E2281C05C; Tue, 24 May 2011 14:50:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3A19E1C00F for ; Tue, 24 May 2011 14:50:13 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BF49B1BC018 for ; Tue, 24 May 2011 14:50:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1521080505 for ; Tue, 24 May 2011 14:50:12 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: <8062053b59ad806fa327bb9dcb06f69acdadc6b7.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, bashast/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/libbashWalker.g scripts/command_execution.bash X-VCS-Directories: scripts/ bashast/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 8062053b59ad806fa327bb9dcb06f69acdadc6b7 Date: Tue, 24 May 2011 14:50:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: a45c37984c8b0c7f030411a2a9495dd1 commit: 8062053b59ad806fa327bb9dcb06f69acdadc6b7 Author: Mu Qiao gentoo org> AuthorDate: Sun May 22 13:42:35 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun May 22 13:42:35 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D8062053b Walker: support negation in command execution Syntax like "! true" is supported now. --- bashast/libbashWalker.g | 3 ++- scripts/command_execution.bash | 1 + 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index bd87ee8..b760f74 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -470,7 +470,8 @@ execute_command[const std::string& name, std::vector<= std::string>& libbash_args] std::cerr << name << " is not supported yet" << std::endl; walker->set_status(1); } - }; + } + (BANG { walker->set_status(!walker->get_status()); })?; =20 argument[std::vector& args] : string_expr { diff --git a/scripts/command_execution.bash b/scripts/command_execution.b= ash index 9e1901c..37cce6e 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -10,6 +10,7 @@ FOO001=3D$(echo hello) FOO002=3D$(hi) true && echo "right" false && echo "wrong" +! true && echo "wrong" false || echo "right" true || echo "wrong" echo "end"