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 1QWOzi-0006Kb-Ct for garchives@archives.gentoo.org; Tue, 14 Jun 2011 08:29:06 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F38C11C033; 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 C2CEE1C033 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 3EAD71B401C 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 1E5C280040 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: <330481c3c8d60d0e2456e5155b857738fc3ffa02.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/brace.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 330481c3c8d60d0e2456e5155b857738fc3ffa02 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: 573bdb6f46ab0b8d49db38826bc75a06 commit: 330481c3c8d60d0e2456e5155b857738fc3ffa02 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Sat Jun 11 12:15:19 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Jun 14 07:23:14 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D330481c3 Parser: fix brace expansion inside bracket pattern We now support expressions like [{a,b}-c]*. As a side benefit code complexity is reduced. --- bashast/bashast.g | 19 ++++++++----------- bashast/gunit/brace.gunit | 1 + 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 2db45de..10e5556 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -455,21 +455,18 @@ pattern_match_trigger | AT; //Pattern matching using brackets bracket_pattern_match - : LSQUARE RSQUARE (BANG|CARET) pattern_match* RSQUARE -> ^(MATCH_ANY_EX= CEPT RSQUARE pattern_match*) - | LSQUARE RSQUARE pattern_match* RSQUARE -> ^(MATCH_ANY RSQUARE pattern= _match*) - | LSQUARE (BANG|CARET) pattern_match+ RSQUARE -> ^(MATCH_ANY_EXCEPT pat= tern_match+) - | LSQUARE pattern_match+ RSQUARE -> ^(MATCH_ANY pattern_match+) + : LSQUARE RSQUARE (BANG|CARET) pattern_match RSQUARE -> ^(MATCH_ANY_EXC= EPT RSQUARE pattern_match) + | LSQUARE RSQUARE pattern_match RSQUARE -> ^(MATCH_ANY RSQUARE pattern_= match) + | LSQUARE (BANG|CARET) pattern_match RSQUARE -> ^(MATCH_ANY_EXCEPT patt= ern_match) + | LSQUARE pattern_match RSQUARE -> ^(MATCH_ANY pattern_match) | TIMES -> MATCH_ALL | QMARK -> MATCH_ONE; -//allowable patterns with bracket pattern matching pattern_match + : pattern_match_atom+; +//allowable patterns with bracket pattern matching +pattern_match_atom : pattern_class_match - | pattern_string_part+; -pattern_string_part - : var_ref - | command_sub - | arithmetic_expansion - | ns_str_part; + | (~RSQUARE) =3D> fname_part; =20 //special class patterns to match: [:alpha:] etc pattern_class_match diff --git a/bashast/gunit/brace.gunit b/bashast/gunit/brace.gunit index 1930560..4d5d6a5 100644 --- a/bashast/gunit/brace.gunit +++ b/bashast/gunit/brace.gunit @@ -31,3 +31,4 @@ fname: "a{b,c}" -> (STRING a (BRACE_EXP (STRING b) (STRING c))) "{c..d}f" -> (STRING (BRACE_EXP (.. c d)) f) "a{a,b}b{c,d}" -> (STRING a (BRACE_EXP (STRING a) (STRING b)) b (BRACE_E= XP (STRING c) (STRING d))) +"[{a,b}-c]*" -> (STRING (MATCH_ANY (BRACE_EXP (STRING a) (STRING b)) - c= ) MATCH_ALL)