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 1QWOze-0006K5-IM for garchives@archives.gentoo.org; Tue, 14 Jun 2011 08:29:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0CEF01C036; Tue, 14 Jun 2011 08:28:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D1EA31C036 for ; Tue, 14 Jun 2011 08:28:48 +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 4D2631B4025 for ; Tue, 14 Jun 2011 08:28:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 743638004B for ; Tue, 14 Jun 2011 08:28:47 +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: <581066529adf685ca48bd7cdc2a2004a77141752.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/fname.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 581066529adf685ca48bd7cdc2a2004a77141752 Date: Tue, 14 Jun 2011 08:28:47 +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: 397bf04ea6d795931d4790f790c9ca28 commit: 581066529adf685ca48bd7cdc2a2004a77141752 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Sat Jun 11 13:08:39 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Jun 14 07:35:51 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D58106652 Parser: fix bracket pattern match negation The negation operator is supposed to be right after the opening left bracket. The right bracket will come after it when it's part of the matched characters. --- bashast/bashast.g | 16 ++++++---------- bashast/gunit/fname.gunit | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 24b94f7..02a36ca 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -455,20 +455,16 @@ pattern_match_trigger | AT; //Pattern matching using brackets bracket_pattern_match - : LSQUARE! bracket_pattern_match_operator + : LSQUARE! bracket_pattern_match_operator^ pattern_match RSQUARE! | TIMES -> MATCH_ALL | QMARK -> MATCH_ONE; bracket_pattern_match_operator - : RSQUARE (BANG|CARET) pattern_match RSQUARE -> ^(MATCH_ANY_EXCEPT RSQU= ARE pattern_match) - | RSQUARE pattern_match RSQUARE -> ^(MATCH_ANY RSQUARE pat= tern_match) - | (BANG|CARET) pattern_match RSQUARE -> ^(MATCH_ANY_EXCEPT patt= ern_match) - | pattern_match RSQUARE -> ^(MATCH_ANY pattern_mat= ch); -pattern_match - : pattern_match_atom+; + : (BANG) =3D> BANG -> MATCH_ANY_EXCEPT + | (CARET) =3D> CARET -> MATCH_ANY_EXCEPT + | -> MATCH_ANY; //allowable patterns with bracket pattern matching -pattern_match_atom - : pattern_class_match - | (~RSQUARE) =3D> fname_part; +pattern_match + : (pattern_class_match|fname_part) (pattern_class_match| (~RSQUARE) =3D= > fname_part)*; =20 //special class patterns to match: [:alpha:] etc pattern_class_match diff --git a/bashast/gunit/fname.gunit b/bashast/gunit/fname.gunit index 799570d..621b29d 100644 --- a/bashast/gunit/fname.gunit +++ b/bashast/gunit/fname.gunit @@ -56,6 +56,7 @@ fname: "ab[!d-h]" -> (STRING ab (MATCH_ANY_EXCEPT d - h)) "ab[^d-h]" -> (STRING ab (MATCH_ANY_EXCEPT d - h)) "ab[]c]" -> (STRING ab (MATCH_ANY ] c)) +"ab[]!]" -> (STRING ab (MATCH_ANY ] !)) "ab[:alpha:]" -> (STRING ab (MATCH_ANY : alpha :)) "ab[=3Dc=3D]" -> (STRING ab (MATCH_ANY =3D c =3D)) "ab[.c.]" -> (STRING ab (MATCH_ANY . c .))