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 <gentoo-commits+bounces-346973-garchives=archives.gentoo.org@lists.gentoo.org>) id 1QOWDs-0005Oi-Pw for garchives@archives.gentoo.org; Mon, 23 May 2011 14:35:09 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E88BC1C056; Mon, 23 May 2011 14:34:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A63AC1C053 for <gentoo-commits@lists.gentoo.org>; Mon, 23 May 2011 14:34:21 +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 5BB8D1B402B for <gentoo-commits@lists.gentoo.org>; Mon, 23 May 2011 14:34:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id BAC1A8050C for <gentoo-commits@lists.gentoo.org>; Mon, 23 May 2011 14:34:20 +0000 (UTC) From: "Petteri Räty" <betelgeuse@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" <betelgeuse@gentoo.org> Message-ID: <9be9015b29fac3e2d2cc6d1f1e44e6de516b6e09.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: bashast/, bashast/gunit/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/bashast.g bashast/gunit/function.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 9be9015b29fac3e2d2cc6d1f1e44e6de516b6e09 Date: Mon, 23 May 2011 14:34:20 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: ccc5c05309ac0606436808961e308a58 commit: 9be9015b29fac3e2d2cc6d1f1e44e6de516b6e09 Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> AuthorDate: Sat May 21 03:13:41 2011 +0000 Commit: Petteri R=C3=A4ty <betelgeuse <AT> gentoo <DOT> org> CommitDate: Mon May 23 15:04:45 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D9be9015b Parser: fix function definition When parentheses are provided after function name, the spaces after the parentheses are optional. Now this is supported in the grammar. --- bashast/bashast.g | 4 ++-- bashast/gunit/function.gunit | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index dd1c92d..404de43 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -553,8 +553,8 @@ arithmetic_expansion process_substitution : (dir=3DLESS_THAN|dir=3DGREATER_THAN)LPAREN clist BLANK* RPAREN -> ^(P= ROCESS_SUBSTITUTION $dir clist); //the biggie: functions -function: FUNCTION BLANK+ function_name (BLANK* parens)? wspace compound= _command redirect* -> ^(FUNCTION ^(STRING function_name) compound_command= redirect*) - | function_name BLANK* parens wspace compound_command redirect* -> ^(FU= NCTION["function"] ^(STRING function_name) compound_command redirect*); +function: FUNCTION BLANK+ function_name ((BLANK* parens wspace*)|wspace)= compound_command redirect* -> ^(FUNCTION ^(STRING function_name) compoun= d_command redirect*) + | function_name BLANK* parens wspace* compound_command redirect* -> ^(F= UNCTION["function"] ^(STRING function_name) compound_command redirect*); //http://article.gmane.org/gmane.comp.shells.bash.bugs/16424 //the rules from bash 3.2 general.c: //Make sure that WORD is a valid shell identifier, i.e. diff --git a/bashast/gunit/function.gunit b/bashast/gunit/function.gunit index a474273..642318e 100644 --- a/bashast/gunit/function.gunit +++ b/bashast/gunit/function.gunit @@ -27,8 +27,10 @@ function: "function quit { exit }" FAIL "function 'foo' { exit; }" FAIL "function quit { exit; }" -> (function (STRING quit) (CURRENT_SHELL (LIS= T (COMMAND (STRING exit))))) -"function foo() { :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (= COMMAND (STRING :))))) -"foo() { :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (COMMAND (= STRING :))))) +"function foo() { :; }" -> (function (STRING foo) (CURRENT_SHELL (LIS= T (COMMAND (STRING :))))) +"function foo(){ :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (C= OMMAND (STRING :))))) +"foo() { :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (COMMAND= (STRING :))))) +"foo(){ :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (COMMAND (S= TRING :))))) =20 "function quit { exit; } > /dev/null" -> (function (STRING quit) (CURREN= T_SHELL (LIST (COMMAND (STRING exit)))) (REDIR > (STRING / dev / null))) "function quit {