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 1QaPkp-0004Kv-K0 for garchives@archives.gentoo.org; Sat, 25 Jun 2011 10:06:20 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 99C6F1C04A; Sat, 25 Jun 2011 10:05:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6B7641C054 for ; Sat, 25 Jun 2011 10:05:51 +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 CD37A1B402E for ; Sat, 25 Jun 2011 10:05:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id ED6A88004F for ; Sat, 25 Jun 2011 10:05:49 +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: <95430b008ae1d3ed9526726a84088f2943d28be4.betelgeuse@gentoo> 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 scripts/compound_command.bash.result X-VCS-Directories: scripts/ bashast/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 95430b008ae1d3ed9526726a84088f2943d28be4 Date: Sat, 25 Jun 2011 10:05:49 +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: 8e9073f3a272da487cd169a3b426c63c commit: 95430b008ae1d3ed9526726a84088f2943d28be4 Author: Mu Qiao gentoo org> AuthorDate: Mon Jun 20 14:39:05 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Thu Jun 23 03:24:42 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D95430b00 Walker: fix a bug in for each loop The index of input stream would be wrong if continue is called and there are no elements left. Now this is fixed. --- bashast/libbashWalker.g | 4 ++-- scripts/compound_command.bash | 8 ++++++++ scripts/compound_command.bash.result | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index fda4ef6..02e2f33 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -710,7 +710,6 @@ for_expr commands_index =3D INDEX(); for(auto iter =3D splitted_values.begin(); iter !=3D splitted_values= .end(); ++iter) { - SEEK(commands_index); walker->set_value(libbash_string, *iter); try { @@ -719,9 +718,10 @@ for_expr catch(continue_exception& e) { e.rethrow_unless_correct_frame(); - continue; } + SEEK(commands_index); } + seek_to_next_tree(ctx); } }) |^(CFOR { diff --git a/scripts/compound_command.bash b/scripts/compound_command.bas= h index 5a04beb..06b4f9e 100644 --- a/scripts/compound_command.bash +++ b/scripts/compound_command.bash @@ -38,6 +38,14 @@ do echo $file done =20 +for file in foo bar +do + if [[ $file =3D=3D "bar" ]]; then + continue + fi + echo $file +done + for outer in 1 2 3 do for file in foo bar diff --git a/scripts/compound_command.bash.result b/scripts/compound_comm= and.bash.result index aeef870..4662025 100644 --- a/scripts/compound_command.bash.result +++ b/scripts/compound_command.bash.result @@ -12,6 +12,7 @@ ghi 9 10 bar +foo 2 foo 2 bar 3 foo