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 1QjWWQ-0003nz-Dn for garchives@archives.gentoo.org; Wed, 20 Jul 2011 13:09:06 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AAA9221C05F; Wed, 20 Jul 2011 13:08:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7F76721C05F for ; Wed, 20 Jul 2011 13:08:56 +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 0418E2AC092 for ; Wed, 20 Jul 2011 13:08:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 286C88003D for ; Wed, 20 Jul 2011 13:08:55 +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: <53f52fea7c45a92771094af3a7dbaa637ecd397a.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, bashast/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/bashast.g scripts/command_execution.bash X-VCS-Directories: scripts/ bashast/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 53f52fea7c45a92771094af3a7dbaa637ecd397a Date: Wed, 20 Jul 2011 13:08:55 +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: 85cfb2ab0c5e2e239a49579f76ea443a commit: 53f52fea7c45a92771094af3a7dbaa637ecd397a Author: Mu Qiao gentoo org> AuthorDate: Wed Jul 20 08:22:33 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed Jul 20 08:22:33 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D53f52fea Parser: fix a bug in escaped double quote handling The internal lexer state for handling double quotes should be changed if the double quote is escaped. Now this is fixed. --- bashast/bashast.g | 7 ++++++- scripts/command_execution.bash | 1 + 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 9681cb1..c69edea 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -120,6 +120,11 @@ tokens{ bool double_quoted =3D false; #else boolean double_quoted =3D false; + + int LA(int index) + { + return input.LA(index); + } #endif } =20 @@ -723,7 +728,7 @@ SEMIC : ';'; DOUBLE_SEMIC : ';;'; PIPE : '|'; -DQUOTE : '"' { double_quoted =3D !double_quoted; }; +DQUOTE : '"' { if(LA(-1) !=3D '\\') double_quoted =3D !double_quoted; }; SQUOTE : { double_quoted }? =3D> '\''; SINGLE_QUOTED_STRING_TOKEN : { !double_quoted }? =3D> '\'' .* '\''; COMMA : ','; diff --git a/scripts/command_execution.bash b/scripts/command_execution.b= ash index 33200bd..3d138fd 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -64,3 +64,4 @@ echo $FOO010 echo "abc #av### ##" # for comment echo $'abc\tdef\nxyz' echo -e "\'\"\t\n" +echo 'quotes should be handled correctly'