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 1QF6PK-0008RF-1E for garchives@archives.gentoo.org; Wed, 27 Apr 2011 15:12:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 57E641C061; Wed, 27 Apr 2011 15:11:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 281591C056 for ; Wed, 27 Apr 2011 15:11:13 +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 AE9651B408B for ; Wed, 27 Apr 2011 15:11:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1070880506 for ; Wed, 27 Apr 2011 15:11:12 +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: 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: d708238429d2687e5362d19e25b5e0bfc6f3eb06 Date: Wed, 27 Apr 2011 15:11:12 +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: e46538d4263649564641d37b5aca3dac commit: d708238429d2687e5362d19e25b5e0bfc6f3eb06 Author: Mu Qiao gentoo org> AuthorDate: Wed Apr 27 14:52:45 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed Apr 27 14:58:44 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dd7082384 Parser: support =3D=3D and !=3D in test built-in Virtual token is used instead of OP['..'] because the previous one can't be handled by tree grammar. --- bashast/bashast.g | 7 +++++-- bashast/gunit/cond_main.gunit | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 9fcacc0..b079d07 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -94,6 +94,8 @@ tokens{ // Avoid ambiguity (being a sign or an operator) PLUS_SIGN; MINUS_SIGN; + // Operators + NOT_EQUALS; } =20 start : (flcomment)? EOL* clist BLANK* (SEMIC|AMP|EOL)? -> clist; @@ -335,7 +337,7 @@ builtin_cond_primary | builtin_cond_unary | fname; builtin_cond_binary - : cond_part BLANK!* binary_string_op_builtin^ BLANK!? cond_part; + : cond_part BLANK!* binary_string_op_builtin^ BLANK!* cond_part; builtin_cond_unary : uop^ BLANK!+ cond_part; keyword_cond @@ -355,8 +357,9 @@ binary_str_op_keyword | GREATER_THAN; binary_string_op_builtin : bop + | EQUALS EQUALS -> EQUALS | EQUALS - | BANG EQUALS -> OP["!=3D"] + | BANG EQUALS -> NOT_EQUALS | ESC_LT | ESC_GT; bop : MINUS! NAME^; diff --git a/bashast/gunit/cond_main.gunit b/bashast/gunit/cond_main.guni= t index 159c734..78ebbf9 100644 --- a/bashast/gunit/cond_main.gunit +++ b/bashast/gunit/cond_main.gunit @@ -25,3 +25,6 @@ cond_expr: "[[ \"asdf\" !=3D \"boo\" && -a filename ]]" -> (KEYWORD_TEST (&& (!=3D = (STRING (DOUBLE_QUOTED_STRING asdf)) (STRING (DOUBLE_QUOTED_STRING boo)))= (a (STRING filename)))) "[[ true ]]" -> (KEYWORD_TEST (STRING true)) "[[ true && (false || three) ]]" -> (KEYWORD_TEST (&& (STRING true) (|| = (STRING false) (STRING three)))) +"[ a =3D b ]" -> (BUILTIN_TEST (=3D (STRING a) (STRING b))) +"[ a =3D=3D b ]" -> (BUILTIN_TEST (=3D (STRING a) (STRING b))) +"[ a !=3D b ]" -> (BUILTIN_TEST (NOT_EQUALS (STRING a) (STRING b)))