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 1QBPhn-0002Z0-Nj for garchives@archives.gentoo.org; Sun, 17 Apr 2011 10:59:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 67E921C0B9; Sun, 17 Apr 2011 10:58:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3B5801C0B9 for ; Sun, 17 Apr 2011 10:58:34 +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 EC91C1BC012 for ; Sun, 17 Apr 2011 10:58:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 5419F80072 for ; Sun, 17 Apr 2011 10:58:33 +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: 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: b680da3520a8fa589848a9c205b52688f3ca13e3 Date: Sun, 17 Apr 2011 10:58:33 +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: af987575eba76095e61bdd76a72a3b48 commit: b680da3520a8fa589848a9c205b52688f3ca13e3 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Sat Apr 16 18:11:54 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun Apr 17 10:57:04 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Db680da35 Parser: function name rules from bash sources Relax the function name rules so that now again most eclasses parse. The implemention is done using negation so hopefully it doesn't break that easily. --- bashast/bashast.g | 7 +++++-- bashast/gunit/function.gunit | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 3b1e4ed..745b1ff 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -523,9 +523,12 @@ process_substitution 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*); //http://article.gmane.org/gmane.comp.shells.bash.bugs/16424 -//the documented set is stricter but we need to have at least what's use= d in Gentoo +//the rules from bash 3.2 general.c: +//Make sure that WORD is a valid shell identifier, i.e. +//does not contain a dollar sign, nor is quoted in any way. Nor +//does it consist of all digits. function_name - : (MINUS|DIGIT|name)+; + : (NUMBER|DIGIT)? ~(DOLLAR|SQUOTE|DQUOTE|LPAREN|RPAREN|BLANK|EOL|NUMBER= |DIGIT) ~(DOLLAR|SQUOTE|DQUOTE|LPAREN|RPAREN|BLANK|EOL)*; parens : LPAREN BLANK* RPAREN; name : NAME | LETTER diff --git a/bashast/gunit/function.gunit b/bashast/gunit/function.gunit index c22821a..a474273 100644 --- a/bashast/gunit/function.gunit +++ b/bashast/gunit/function.gunit @@ -37,3 +37,11 @@ function: "function help { echo hi; } 2> /dev/null" -> (function (STRING help) (CU= RRENT_SHELL (LIST (COMMAND (STRING echo) (STRING hi)))) (REDIR 2 > (STRIN= G / dev / null))) "function help { echo 3; } 2> /dev/null > output" OK "xorg-2_reconf_source() { :; }" -> (function (STRING xorg - 2 _reconf_so= urce) (CURRENT_SHELL (LIST (COMMAND (STRING :))))) + +function_name: +"xemacs-packages_src_unpack" OK +"while" OK +"aa'bb" FAIL +"a\"" FAIL +"333" FAIL +"aa$aa" FAIL