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 1QYNTE-0001Mo-RG for garchives@archives.gentoo.org; Sun, 19 Jun 2011 19:15:45 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 21AFA1C02A; Sun, 19 Jun 2011 19:15:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D6CBE1C02A for ; Sun, 19 Jun 2011 19:15:36 +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 2A7021B401E for ; Sun, 19 Jun 2011 19:15:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 88FDC8003E for ; Sun, 19 Jun 2011 19:15:35 +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: <02899a60a03eb3b24b26df3b8e801da59e614c33.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/cond_main.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 02899a60a03eb3b24b26df3b8e801da59e614c33 Date: Sun, 19 Jun 2011 19:15:35 +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: 0d1e0c08fbdfc7998dbef2e789b27f8d commit: 02899a60a03eb3b24b26df3b8e801da59e614c33 Author: Mu Qiao gentoo org> AuthorDate: Tue Jun 14 07:49:27 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun Jun 19 19:07:06 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D02899a60 Parser: support -a and -o in built-in test Note that we don't respect the operator precedence for now. Fixing that should have to involve semantic predicate. --- bashast/bashast.g | 5 +++-- bashast/gunit/cond_main.gunit | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index ca3abc9..571ed54 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -103,6 +103,7 @@ tokens{ MINUS_SIGN; // Operators NOT_EQUALS; + BUILTIN_LOGIC; } =20 start : (flcomment)? EOL* clist BLANK* (SEMIC|AMP|EOL)? EOF -> clist; @@ -364,8 +365,7 @@ builtin_cond_unary keyword_cond : (negate_primary|cond_primary) (BLANK!* (LOGICOR^|LOGICAND^) BLANK!* k= eyword_cond)?; builtin_cond - : negate_builtin_primary - | builtin_cond_primary; + : (negate_builtin_primary|builtin_cond_primary) (BLANK!* builtin_logic_= operator^ BLANK!* builtin_cond)?; negate_primary : BANG BLANK+ cond_primary -> ^(NEGATION cond_primary); negate_builtin_primary @@ -388,6 +388,7 @@ bop : MINUS! NAME^; unary_cond : uop^ BLANK! cond_part; uop : MINUS! LETTER; +builtin_logic_operator : uop -> ^(BUILTIN_LOGIC uop); //Allowable parts of conditions cond_part: brace_expansion | fname; diff --git a/bashast/gunit/cond_main.gunit b/bashast/gunit/cond_main.guni= t index 2c1eee7..a17ae1e 100644 --- a/bashast/gunit/cond_main.gunit +++ b/bashast/gunit/cond_main.gunit @@ -31,3 +31,5 @@ cond_expr: "[ a =3D=3D b ]" -> (BUILTIN_TEST (=3D (STRING a) (STRING b))) "[ a !=3D b ]" -> (BUILTIN_TEST (NOT_EQUALS (STRING a) (STRING b))) "[[ \"${DISTUTILS_SRC_TEST}\" =3D~ ^(setup\.py|nosetests|py\.test|trial(= \ .*)?)$ ]]" -> (KEYWORD_TEST (MATCH_REGULAR_EXPRESSION (STRING (DOUBLE_Q= UOTED_STRING (VAR_REF DISTUTILS_SRC_TEST))) (STRING ^ ( setup \ . py | no= setests | py \ . test | trial ( \ . * ) ? ) $))) +"[ -n "$FROM_LANG" -a -n "$TO_LANG" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC a= (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF FROM_LANG)))) (n (STRING (DOUB= LE_QUOTED_STRING (VAR_REF TO_LANG)))))) +"[ -n "$FROM_LANG" -o -n "$TO_LANG" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC o= (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF FROM_LANG)))) (n (STRING (DOUB= LE_QUOTED_STRING (VAR_REF TO_LANG))))))