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 1QQe2i-0004Xc-J3 for garchives@archives.gentoo.org; Sun, 29 May 2011 11:20:26 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7FA201C02A; Sun, 29 May 2011 11:20:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4942A1C025 for ; Sun, 29 May 2011 11:20:07 +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 D4F1B1B4044 for ; Sun, 29 May 2011 11:20:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 117628050E for ; Sun, 29 May 2011 11:20: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: <4f4eff53b4ad98e386010f7d9717c3192954a0dc.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: 4f4eff53b4ad98e386010f7d9717c3192954a0dc Date: Sun, 29 May 2011 11:20: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: 3586159ffc7b66e156bc9a2335b9d0fb commit: 4f4eff53b4ad98e386010f7d9717c3192954a0dc Author: Mu Qiao gentoo org> AuthorDate: Fri May 27 14:22:01 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun May 29 11:44:52 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D4f4eff53 Walker: support continue in while and until loop --- bashast/libbashWalker.g | 11 ++++++- scripts/compound_command.bash | 52 ++++++++++++++++++++++++++++= ++++++ scripts/compound_command.bash.result | 9 ++++++ 3 files changed, 71 insertions(+), 1 deletions(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index f2fba4a..5c8c371 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -703,7 +703,16 @@ while_expr command_list(ctx); if(walker->get_status() =3D=3D (negate? 0 : 1)) break; - command_list(ctx); + try + { + command_list(ctx); + } + catch(continue_exception& e) + { + e.rethrow_unless_correct_frame(); + SEEK(condition_index); + continue; + } SEEK(condition_index); } // Skip the body and get out diff --git a/scripts/compound_command.bash b/scripts/compound_command.bas= h index bb7961c..a81e395 100644 --- a/scripts/compound_command.bash +++ b/scripts/compound_command.bash @@ -54,6 +54,32 @@ do echo "Shouldn't print this" done =20 +i=3D0 +while [ $i !=3D 4 ] +do + i=3D$(( i + 1 )) + if [[ $i =3D=3D 1 ]]; then + continue + fi + echo $i +done + +i=3D0 +j=3D1 +while [ $i !=3D 4 ] +do + i=3D$(( i + 1 )) + =20 + while [ $j =3D=3D 1 ] + do + if [[ $i =3D=3D 1 ]]; then + continue 2 + fi + echo $i + let ++j + done +done + i=3D0; until [ $i =3D=3D 4 ] do @@ -66,6 +92,32 @@ do echo "Shouldn't print this" done =20 +i=3D0 +until [ $i =3D=3D 4 ] +do + i=3D$(( i + 1 )) + if [[ $i =3D=3D 1 ]]; then + continue + fi + echo $i +done + +i=3D0 +j=3D1 +until [ $i =3D=3D 4 ] +do + i=3D$(( i + 1 )) + =20 + while [ $j =3D=3D 1 ] + do + if [[ $i =3D=3D 1 ]]; then + continue 2 + fi + echo $i + let ++j + done +done + a=3D1 b=3D2 if [ $a =3D=3D $b ] diff --git a/scripts/compound_command.bash.result b/scripts/compound_comm= and.bash.result index 6014421..0450c8f 100644 --- a/scripts/compound_command.bash.result +++ b/scripts/compound_command.bash.result @@ -20,10 +20,18 @@ bar 2 3 4 +2 +3 +4 +2 1 2 3 4 +2 +3 +4 +2 1 2 1 @@ -45,5 +53,6 @@ b=3D2 file=3Dbar foo=3Dghi i=3D4 +j=3D2 outer=3D3 target=3D_