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 1Q9Ay7-0001Qi-FV for garchives@archives.gentoo.org; Mon, 11 Apr 2011 06:51:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8D0E01C04B; Mon, 11 Apr 2011 06:50:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4E66B1C04B for ; Mon, 11 Apr 2011 06:50:39 +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 C9D851B40D4 for ; Mon, 11 Apr 2011 06:50:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 29D8D80065 for ; Mon, 11 Apr 2011 06:50:38 +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: <1caaf7cda55268d34292bc4e579d861a03fc978c.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/compound.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 1caaf7cda55268d34292bc4e579d861a03fc978c Date: Mon, 11 Apr 2011 06:50:38 +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: 07fb4ef45b0abe570f6e7690d6600f71 commit: 1caaf7cda55268d34292bc4e579d861a03fc978c Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Sun Apr 10 14:17:48 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Mon Apr 11 06:45:53 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D1caaf7cd Better whitespace handling for while and friends You are allowed to have whitespace before the semicolon in a while expression. There's now a generic fix for this in the semiel rule. --- bashast/bashast.g | 6 +++--- bashast/gunit/compound.gunit | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 3ded797..1026169 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -176,11 +176,11 @@ for_expr: FOR BLANK+ name (wspace IN BLANK+ word)? = semiel DO wspace* clist semie ; sel_expr: SELECT BLANK+ name (wspace IN BLANK+ word)? semiel DO wspace* = clist semiel DONE -> ^(SELECT name (word)? clist) ; -if_expr : IF wspace+ ag=3Dclist BLANK* semiel THEN wspace+ iflist=3Dclis= t BLANK? semiel EOL* (elif_expr)* (ELSE wspace+ else_list=3Dclist BLANK? = semiel EOL*)? FI +if_expr : IF wspace+ ag=3Dclist semiel THEN wspace+ iflist=3Dclist semie= l EOL* (elif_expr)* (ELSE wspace+ else_list=3Dclist semiel EOL*)? FI -> ^(IF $ag $iflist (elif_expr)* ^($else_list)?) ; elif_expr - : ELIF BLANK+ ag=3Dclist BLANK* semiel THEN wspace+ iflist=3Dclist BLAN= K* semiel -> ^(IF["if"] $ag $iflist); + : ELIF BLANK+ ag=3Dclist semiel THEN wspace+ iflist=3Dclist semiel -> ^= (IF["if"] $ag $iflist); while_expr : WHILE wspace? istrue=3Dclist semiel DO wspace dothis=3Dclist semiel D= ONE -> ^(WHILE $istrue $dothis) ; @@ -329,7 +329,7 @@ cond_part: brace_expansion | arithmetic; //Rules for whitespace/line endings wspace : BLANK+|EOL+; -semiel : (SEMIC|EOL) BLANK*; +semiel : BLANK* (SEMIC|EOL) BLANK*; =20 //definition of word. this is just going to grow... word : (brace_expansion) =3D> brace_expansion diff --git a/bashast/gunit/compound.gunit b/bashast/gunit/compound.gunit index 531e0ff..0814978 100644 --- a/bashast/gunit/compound.gunit +++ b/bashast/gunit/compound.gunit @@ -122,6 +122,9 @@ done" -> (while (LIST (COMMAND (STRING echo) (STRING = true))) (LIST (COMMAND (STR "while echo true; do echo \"file found\"; done" -> (while (LIST (COMMAND= (STRING echo) (STRING true))) (LIST (COMMAND (STRING echo) (STRING (DOUB= LE_QUOTED_STRING file found))))) "while(( 1>0 )); do echo ok; done" -> (while (LIST (COMPOUND_ARITH (> 1 = 0))) (LIST (COMMAND (STRING echo) (STRING ok)))) "while echo true`; do echo file done" FAIL +"while [[ -n \"$ver_str\" ]] ; do + echo true + done" -> (while (LIST (COMPOUND_COND (KEYWORD_TEST (n (STRING (DOUBLE_Q= UOTED_STRING (VAR_REF ver_str))))))) (LIST (COMMAND (STRING echo) (STRING= true)))) =20 until_expr: "until echo true; do