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 1QKWXy-0008Iq-D2 for garchives@archives.gentoo.org; Thu, 12 May 2011 14:07:22 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D95471C0DA; Thu, 12 May 2011 14:06:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A9BB81C0DA for ; Thu, 12 May 2011 14:06:54 +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 3B3B31BC0F7 for ; Thu, 12 May 2011 14:06:54 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 7B65980505 for ; Thu, 12 May 2011 14:06:53 +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: <82268e958be9caee5d9e71d14d27d0d25fd36ee6.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: 82268e958be9caee5d9e71d14d27d0d25fd36ee6 Date: Thu, 12 May 2011 14:06:53 +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: 8c13b2caebafcb6bc1180b2cbb655c85 commit: 82268e958be9caee5d9e71d14d27d0d25fd36ee6 Author: Mu Qiao gentoo org> AuthorDate: Wed May 11 13:46:14 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed May 11 13:48:05 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D82268e95 Walker: support character class in patterns --- bashast/libbashWalker.g | 11 ++++++++++- scripts/compound_command.bash | 18 ++++++++++++++++++ scripts/compound_command.bash.result | 5 ++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 6c9e0c1..407c8b6 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -227,7 +227,16 @@ bash_pattern[boost::xpressive::sregex& pattern, bool= greedy] } |(MATCH_ANY_EXCEPT|MATCH_ANY) =3D> ^((MATCH_ANY_EXCEPT { negation =3D true; } | MATCH_ANY { negation =3D = false; }) - (s=3Dstring_part { pattern_str +=3D s.libbash_value; })+) { + ((CHARACTER_CLASS) =3D> ^(CHARACTER_CLASS n=3DNAME) { + std::string class_name =3D walker->get_string(n); + if(class_name =3D=3D "word") + pattern_str +=3D "A-Za-z0-9_"; + else if(class_name =3D=3D "ascii") + pattern_str +=3D "\\x00-\\x7F"; + else + pattern_str +=3D "[:" + class_name + ":]"; + } + |s=3Dstring_part { pattern_str +=3D s.libbash_value; })+) { =20 if(negation) pattern_str =3D "[^" + pattern_str + "]"; diff --git a/scripts/compound_command.bash b/scripts/compound_command.bas= h index a75898f..daeef24 100644 --- a/scripts/compound_command.bash +++ b/scripts/compound_command.bash @@ -160,4 +160,22 @@ case $target in echo yep ;; esac +target=3D"a" +case $target in + [[:alnum:][:alpha:][:ascii:][:blank:][:cntrl:][:digit:][:graph:][:lo= wer:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]) + echo yep + ;; +esac +target=3D"a" +case $target in + [[:ascii:]]) + echo yep + ;; +esac +target=3D"_" +case $target in + [[:word:]]) + echo yep + ;; +esac echo "case end" diff --git a/scripts/compound_command.bash.result b/scripts/compound_comm= and.bash.result index 255c8eb..2a23d0c 100644 --- a/scripts/compound_command.bash.result +++ b/scripts/compound_command.bash.result @@ -31,10 +31,13 @@ yep yep yep yep +yep +yep +yep case end a=3D1 b=3D2 file=3D foo bar=20 foo=3Dghi i=3D4 -target=3Dbar +target=3D_