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 1QIgZL-0001yL-5t for garchives@archives.gentoo.org; Sat, 07 May 2011 12:25:11 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9B921C025; Sat, 7 May 2011 12:25:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AA7311C025 for ; Sat, 7 May 2011 12:25:03 +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 3855B1B4050 for ; Sat, 7 May 2011 12:25:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 3D26280508 for ; Sat, 7 May 2011 12:25:02 +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: / X-VCS-Repository: proj/libbash X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: ce9c217021e2154a64f8ed3b3e7c492bc8a4c917 Date: Sat, 7 May 2011 12:25:02 +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: 7d61d06d784ba5a30c28500ba377abde commit: ce9c217021e2154a64f8ed3b3e7c492bc8a4c917 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Sat May 7 12:23:34 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sat May 7 12:23:34 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dce9c2170 Merge remote-tracking branch 'mu/local_variables' Conflicts: scripts/function_def.bash bashast/bashast.g | 5 ++- bashast/gunit/simp_command.gunit | 1 + bashast/libbashWalker.g | 20 ++++++++++++++---- scripts/function_def.bash | 10 +++++++++ scripts/function_def.bash.result | 1 + src/core/interpreter.cpp | 40 ++++++++++++++++++++++++++++++++= +---- src/core/interpreter.h | 39 +++++++++++++++++++++-----------= ---- 7 files changed, 88 insertions(+), 28 deletions(-) diff --cc bashast/libbashWalker.g index beabfdf,1a305ef..f39e603 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@@ -283,21 -292,13 +293,21 @@@ simple_comman @declarations { std::vector libbash_args; } - :^(COMMAND string_expr (argument[libbash_args])* var_def*) { + :^(COMMAND string_expr (argument[libbash_args])* var_def[true]*) { if(walker->has_function($string_expr.libbash_value)) { - walker->set_status(walker->call($string_expr.libbash_value, - libbash_args, - ctx, - compound_command)); + ANTLR3_MARKER command_index =3D INDEX(); + try + { + walker->set_status(walker->call($string_expr.libbash_value, + libbash_args, + ctx, + compound_command)); + } + catch(return_exception& e) + { + SEEK(command_index); + } } else if(cppbash_builtin::is_builtin($string_expr.libbash_value)) { diff --cc scripts/function_def.bash index ee57a94,cbce4cd..bcf5a4b --- a/scripts/function_def.bash +++ b/scripts/function_def.bash @@@ -27,18 -27,12 +27,28 @@@ ARRAY=3D(1 2 3 func_with_args ${ARRAY[@]} $FOO001 func_with_args 100 $ARG2 $ARG3 $ARG4 =20 +func_with_return() +{ + return 1 + NOT_EXIST=3D1 +} +func_with_return +RETURN_STATUS=3D$? +func_with_return2() +{ + true + return + NOT_EXIST=3D1 +} +func_with_return2 +RETURN_STATUS2=3D$? ++ + func_nested1() { + echo $foo_nested ${bar_nested[0]} + } + func_nested2() { + local foo_nested=3Dhi bar_nested=3D(1 2 + 3) + func_nested1 + } + func_nested2