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 1QoyQl-0006yb-59 for garchives@archives.gentoo.org; Thu, 04 Aug 2011 13:57:47 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1E5CF21C201; Thu, 4 Aug 2011 13:53:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DDD5F21C1F3 for ; Thu, 4 Aug 2011 13:53:44 +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 54B302AC015 for ; Thu, 4 Aug 2011 13:53:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B0DB08004A for ; Thu, 4 Aug 2011 13:53:43 +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/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/bashast.g X-VCS-Directories: bashast/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: f3a533ddaec1c7b7258145aea38ab698da8fb545 Date: Thu, 4 Aug 2011 13:53:43 +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: f02a9e864bacf0c1330f46c4a953e7eb commit: f3a533ddaec1c7b7258145aea38ab698da8fb545 Author: Mu Qiao gentoo org> AuthorDate: Tue Jul 26 15:00:55 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Aug 2 07:52:18 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Df3a533dd Parser: make the lexer code thread-safe --- bashast/bashast.g | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 9c248e4..bb70aec 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -127,18 +127,31 @@ tokens{ BUILTIN_LOGIC; } =20 -@lexer::members +@lexer::context { #ifdef OUTPUT_C - bool double_quoted =3D false; -#else - boolean double_quoted =3D false; + bool double_quoted; + int paren_level; +#endif +} + +@lexer::apifuncs +{ +#ifdef OUTPUT_C + ctx->double_quoted =3D false; + ctx->paren_level =3D 0; +#endif +} =20 +@lexer::members +{ +#ifndef OUTPUT_C + boolean double_quoted =3D false; + int paren_level =3D 0; int LA(int index) { return input.LA(index); } #endif - int paren_level =3D 0; } #ifdef OUTPUT_C @includes { @@ -149,6 +162,10 @@ tokens{ =20 C_INCLUDE #include "core/exceptions.h" } +@lexer::postinclude { + #define double_quoted ctx->double_quoted + #define paren_level ctx->paren_level +} #endif @members {