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 1QXFpG-0005Qt-EQ for garchives@archives.gentoo.org; Thu, 16 Jun 2011 16:53:50 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8D5E41C097; Thu, 16 Jun 2011 16:53:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5E87E1C09C for ; Thu, 16 Jun 2011 16:53:28 +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 E6AF81BC015 for ; Thu, 16 Jun 2011 16:53:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id ABED18004B for ; Thu, 16 Jun 2011 16:53:26 +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: <4006e69739fa88f24ab9e79797217e5648413b3e.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, bashast/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/libbashWalker.g scripts/test_expr.bash scripts/test_expr.bash.result X-VCS-Directories: scripts/ bashast/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 4006e69739fa88f24ab9e79797217e5648413b3e Date: Thu, 16 Jun 2011 16:53:26 +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: 1fbfe8094578a8b774537b3a4e401355 commit: 4006e69739fa88f24ab9e79797217e5648413b3e Author: Mu Qiao gentoo org> AuthorDate: Thu Jun 16 10:05:18 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Thu Jun 16 10:05:18 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D4006e697 Walker: support regular expression in keyword test --- bashast/libbashWalker.g | 4 ++++ scripts/test_expr.bash | 2 ++ scripts/test_expr.bash.result | 1 + 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 5469f84..9d297d2 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -649,6 +649,10 @@ keyword_condition returns[bool status] :^(LOGICOR l=3Dkeyword_condition r=3Dkeyword_condition) { $status=3D l = || r; } |^(LOGICAND l=3Dkeyword_condition r=3Dkeyword_condition) { $status=3D l= && r; } |^(NEGATION l=3Dkeyword_condition) { $status =3D !l; } + |^(MATCH_REGULAR_EXPRESSION left_str=3Dstring_expr right_str=3Dstring_e= xpr) { + boost::xpressive::sregex re =3D boost::xpressive::sregex::compile(righ= t_str.libbash_value); + $status =3D boost::xpressive::regex_match(left_str.libbash_value, re); + } |s=3Dcommon_condition { $status =3D s; }; =20 builtin_condition returns[bool status] diff --git a/scripts/test_expr.bash b/scripts/test_expr.bash index 1fa00b4..f1f3093 100644 --- a/scripts/test_expr.bash +++ b/scripts/test_expr.bash @@ -48,3 +48,5 @@ i=3D2 [[ i++ -gt 2 ]] && echo wrong [[ i++ -gt 2 ]] && echo true16 unset i +[[ "setup.py" =3D~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]] && e= cho true17 +[[ "setup.py" =3D~ ^(setup\.p|nosetests|py\.test|trial(\ .*)?)$ ]] && ec= ho false diff --git a/scripts/test_expr.bash.result b/scripts/test_expr.bash.resul= t index e883295..2082757 100644 --- a/scripts/test_expr.bash.result +++ b/scripts/test_expr.bash.result @@ -23,3 +23,4 @@ true13 true14 true15 true16 +true17