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 1QUZeC-0007mr-Vm for garchives@archives.gentoo.org; Thu, 09 Jun 2011 07:27:21 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C89811C065; Thu, 9 Jun 2011 07:27:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 9990F1C065 for ; Thu, 9 Jun 2011 07:27:08 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2B8E11B4022 for ; Thu, 9 Jun 2011 07:27:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id ED39A80040 for ; Thu, 9 Jun 2011 07:27:06 +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: Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, bashast/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/libbashWalker.g scripts/compound_command.bash X-VCS-Directories: scripts/ bashast/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: a4825412c8b69296d4c817df139ca7841936efa4 Date: Thu, 9 Jun 2011 07:27:06 +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: 0291191731d6edcdfa837438e02ee701 commit: a4825412c8b69296d4c817df139ca7841936efa4 Author: Mu Qiao gentoo org> AuthorDate: Wed Jun 8 14:56:43 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Thu Jun 9 07:23:33 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Da4825412 Walker: fix case command with empty body --- bashast/libbashWalker.g | 22 +++++++++++----------- scripts/compound_command.bash | 7 +++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 39b0a16..8263b15 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -834,24 +834,24 @@ case_clause[const std::string& target] returns[bool= matched] std::vector patterns; } :^(CASE_PATTERN ( { patterns.push_back(boost::xpressive::sregex()); } b= ash_pattern[patterns.back(), true])+ { - if(LA(1) =3D=3D CASE_COMMAND) - { - // omit CASE_COMMAND - SEEK(INDEX() + 1); - $matched =3D false; + $matched =3D false; =20 - for(auto iter =3D patterns.begin(); iter !=3D patterns.end(); ++iter) + for(auto iter =3D patterns.begin(); iter !=3D patterns.end(); ++iter) + { + if(match(target, *iter)) { - if(match(target, *iter)) + if(LA(1) =3D=3D CASE_COMMAND) { + // omit CASE_COMMAND + SEEK(INDEX() + 1); command_list(ctx); - $matched =3D true; - break; } + $matched =3D true; + break; } - if(!$matched) - seek_to_next_tree(ctx); } + if(!$matched) + seek_to_next_tree(ctx); }); =20 command_substitution returns[std::string libbash_value] diff --git a/scripts/compound_command.bash b/scripts/compound_command.bas= h index a81e395..7a4e526 100644 --- a/scripts/compound_command.bash +++ b/scripts/compound_command.bash @@ -181,6 +181,13 @@ case $target in echo "default" ;; esac +case $target in + abc|bcd|xyz) + ;; + *) + echo "Shouldn't print this" + ;; +esac target=3Da case $target in [def])