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 1QoyPC-0006PU-Es for garchives@archives.gentoo.org; Thu, 04 Aug 2011 13:56:10 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0C6F421C1E3; Thu, 4 Aug 2011 13:53:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C44D921C1E3 for ; Thu, 4 Aug 2011 13:53:41 +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 7564D1B402F for ; Thu, 4 Aug 2011 13:53:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CD8438004B for ; Thu, 4 Aug 2011 13:53:40 +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: <7c27bffcc90d0c6a5dccd1dbb4bf0db9c4ee6104.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/arith_main.gunit bashast/gunit/array.gunit bashast/gunit/param_main.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 7c27bffcc90d0c6a5dccd1dbb4bf0db9c4ee6104 Date: Thu, 4 Aug 2011 13:53:40 +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: 70fe337442471de092bf2b58fb67dada commit: 7c27bffcc90d0c6a5dccd1dbb4bf0db9c4ee6104 Author: Mu Qiao gentoo org> AuthorDate: Thu Jul 21 13:57:02 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Aug 2 07:46:29 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D7c27bffc Parser: remove tokens for +=3D and -=3D This makes ${a:-=3D} and ${a:+=3D} work properly. --- bashast/bashast.g | 18 +++++++++--------- bashast/gunit/arith_main.gunit | 4 ++-- bashast/gunit/array.gunit | 4 ++-- bashast/gunit/param_main.gunit | 3 +++ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index b4804fa..0a9557e 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -111,6 +111,8 @@ tokens{ =20 PLUS_SIGN; MINUS_SIGN; + PLUS_ASSIGN; + MINUS_ASSIGN; =20 NOT_EQUALS; EQUALS_TO; @@ -311,7 +313,7 @@ command_atom : (FOR|SELECT|IF|WHILE|UNTIL|CASE|LPAREN|LBRACE|LLPAREN|LSQUARE|TEST_EX= PR) =3D> compound_command | FUNCTION BLANK string_expr_no_reserved_word ((BLANK? parens wspace?)|= wspace) compound_command -> ^(FUNCTION string_expr_no_reserved_word compound_command) - | (name (LSQUARE|EQUALS|PLUS_ASSIGN)|LOCAL|EXPORT) =3D> variable_defini= tions + | (name (LSQUARE|EQUALS|PLUS EQUALS)|LOCAL|EXPORT) =3D> variable_defini= tions ( (BLANK bash_command) =3D> BLANK bash_command -> bash_command variabl= e_definitions | -> ^(VARIABLE_DEFINITIONS variable_definitions) @@ -351,7 +353,7 @@ command_atom =20 variable_definitions : ( - variable_definition_atom ((BLANK name (LSQUARE|EQUALS|PLUS_ASSIGN)) =3D= > BLANK! variable_definition_atom)* + variable_definition_atom ((BLANK name (LSQUARE|EQUALS|PLUS EQUALS)) =3D= > BLANK! variable_definition_atom)* | (LOCAL) =3D> LOCAL BLANK! local_item ((BLANK name) =3D> BLANK! loca= l_item)* | (EXPORT) =3D> EXPORT! ((BLANK name) =3D> BLANK! export_item)+ ); @@ -360,8 +362,8 @@ variable_definition_atom : name LSQUARE BLANK? explicit_arithmetic BLANK? RSQUARE EQUALS string_= expr? -> ^(EQUALS ^(name explicit_arithmetic) string_expr?) | name EQUALS value? -> ^(EQUALS name value?) - | name PLUS_ASSIGN array_value -> ^(PLUS_ASSIGN name array_value) - | name PLUS_ASSIGN string_expr_part? + | name PLUS EQUALS array_value -> ^(PLUS_ASSIGN name array_value) + | name PLUS EQUALS string_expr_part? -> ^(EQUALS name ^(STRING ^(VAR_REF name) string_expr_part?)); value : string_expr @@ -658,7 +660,7 @@ string_part ns_string_part : num|name|escaped_character |OTHER|EQUALS|PCT|PCTPCT|PLUS|MINUS|DOT|DOTDOT|COLON|TEST_EXPR - |TILDE|MUL_ASSIGN|DIVIDE_ASSIGN|MOD_ASSIGN|PLUS_ASSIGN|MINUS_ASSIGN + |TILDE|MUL_ASSIGN|DIVIDE_ASSIGN|MOD_ASSIGN |LSHIFT_ASSIGN|RSHIFT_ASSIGN|AND_ASSIGN|XOR_ASSIGN|LSQUARE|RSQUARE |OR_ASSIGN|CARET|POUND|POUNDPOUND|COMMA|EXPORT|LOCAL|AT; =20 @@ -878,8 +880,8 @@ arithmetic_assignment_operator | MUL_ASSIGN | DIVIDE_ASSIGN | MOD_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN + | PLUS EQUALS -> PLUS_ASSIGN + | MINUS EQUALS -> MINUS_ASSIGN | LSHIFT_ASSIGN | RSHIFT_ASSIGN | AND_ASSIGN @@ -993,8 +995,6 @@ RSHIFT : '>>'; MUL_ASSIGN : '*=3D'; DIVIDE_ASSIGN : '/=3D'; MOD_ASSIGN : '%=3D'; -PLUS_ASSIGN : '+=3D'; -MINUS_ASSIGN : '-=3D'; LSHIFT_ASSIGN : '<<=3D'; RSHIFT_ASSIGN : '>>=3D'; AND_ASSIGN : '&=3D'; diff --git a/bashast/gunit/arith_main.gunit b/bashast/gunit/arith_main.gu= nit index 5249b5a..c32ff21 100644 --- a/bashast/gunit/arith_main.gunit +++ b/bashast/gunit/arith_main.gunit @@ -111,8 +111,8 @@ arithmetics_test: "var *=3D 5" -> (*=3D var 5) "var /=3D 5" -> (/=3D var 5) "var %=3D 5" -> (%=3D var 5) -"asdf +=3D 5" -> (+=3D asdf 5) -"var -=3D 5" -> (-=3D var 5) +"asdf +=3D 5" -> (PLUS_ASSIGN asdf 5) +"var -=3D 5" -> (MINUS_ASSIGN var 5) "var <<=3D 5" -> (<<=3D var 5) "var >>=3D 5" -> (>>=3D var 5) "var &=3D 5" -> (&=3D var 5) diff --git a/bashast/gunit/array.gunit b/bashast/gunit/array.gunit index b3bdf3b..c304e7c 100644 --- a/bashast/gunit/array.gunit +++ b/bashast/gunit/array.gunit @@ -28,8 +28,8 @@ variable_definition_atom: ${VAR} )" -> (=3D asdf (ARRAY (STRING - - disable - dependency - tracking) (STR= ING (VAR_REF VAR)))) "asdf=3D()" -> (=3D asdf ARRAY) -"asdf+=3D()" -> (+=3D asdf ARRAY) -"asdf+=3D(a)" -> (+=3D asdf (ARRAY (STRING a))) +"asdf+=3D()" -> (PLUS_ASSIGN asdf ARRAY) +"asdf+=3D(a)" -> (PLUS_ASSIGN asdf (ARRAY (STRING a))) =20 variable_reference: "$asdf" -> (VAR_REF asdf) diff --git a/bashast/gunit/param_main.gunit b/bashast/gunit/param_main.gu= nit index 306d3c6..0a56a57 100644 --- a/bashast/gunit/param_main.gunit +++ b/bashast/gunit/param_main.gunit @@ -22,6 +22,9 @@ variable_reference: "$asdf" -> (VAR_REF asdf) "${asdf}" -> (VAR_REF asdf) "${asdf:-foo}" -> (VAR_REF (USE_DEFAULT_WHEN_UNSET_OR_NULL asdf (STRING = foo))) +"${asdf:-=3D}" -> (VAR_REF (USE_DEFAULT_WHEN_UNSET_OR_NULL asdf (STRING = =3D))) +"${asdf:+=3D}" -> (VAR_REF (USE_ALTERNATE_WHEN_UNSET_OR_NULL asdf (STRIN= G =3D))) +"${asdf:=3D=3D}" -> (VAR_REF (ASSIGN_DEFAULT_WHEN_UNSET_OR_NULL asdf (ST= RING =3D))) "${asdf:-public_html}" -> (VAR_REF (USE_DEFAULT_WHEN_UNSET_OR_NULL asdf = (STRING public_html))) "${asdf=3D'foo'}" -> (VAR_REF (ASSIGN_DEFAULT_WHEN_UNSET asdf (STRING 'f= oo'))) "${asdf:=3D}" -> (VAR_REF (ASSIGN_DEFAULT_WHEN_UNSET_OR_NULL asdf (STRIN= G EMPTY_EXPANSION_VALUE)))