From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 25AAF2C7A0 for ; Thu, 16 May 2019 19:05:38 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F4Pj04F8y61H for ; Thu, 16 May 2019 19:05:38 -0400 (EDT) Received: from smtp5.mail.ru (smtp5.mail.ru [94.100.179.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 8EB9C2ACBA for ; Thu, 16 May 2019 19:05:37 -0400 (EDT) From: "n.pettik" Message-Id: <125E170E-686D-4AA6-BA76-D0F7B01C96B8@tarantool.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_48CE30EA-50A2-4C87-95D3-79334DFF9DBF" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: do not replace the error with a syntax error Date: Fri, 17 May 2019 02:05:34 +0300 In-Reply-To: <114523ac-bf18-097d-fcd4-9cead7027b43@tarantool.org> References: <76ecaa6e2ba8a69f421a73bb25fb857cf5bbe001.1557244912.git.imeevma@gmail.com> <8D8884F5-961C-477F-B5AD-8723C0BBB674@tarantool.org> <20190515172839.GA10603@tarantool.org> <20190515185225.GA21356@tarantool.org> <50DB5A78-5190-40D5-A3D6-2FFD7BA0A3E3@tarantool.org> <114523ac-bf18-097d-fcd4-9cead7027b43@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Imeev Mergen --Apple-Mail=_48CE30EA-50A2-4C87-95D3-79334DFF9DBF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 15 May 2019, at 22:33, Imeev Mergen wrote: > On 5/15/19 10:28 PM, n.pettik wrote: >>=20 >>> diff --git a/extra/lempar.c b/extra/lempar.c >>> index d043e39..595f89e 100644 >>> --- a/extra/lempar.c >>> +++ b/extra/lempar.c >>> @@ -935,7 +935,8 @@ void Parse( >>> yymajor =3D YYNOCODE; >>> #endif >>> } >>> - }while( yymajor!=3DYYNOCODE && = yypParser->yytos>yypParser->yystack ); >>> + }while( yymajor!=3DYYNOCODE && = yypParser->yytos>yypParser->yystack >>> + PARSER_ERROR_CHECK); >>> #ifndef NDEBUG >>> if( yyTraceFILE ){ >>> yyStackEntry *i; >>> diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y >>> index 3a443a0..f241b8d 100644 >>> --- a/src/box/sql/parse.y >>> +++ b/src/box/sql/parse.y >>> @@ -80,6 +80,13 @@ >>> #define YYMALLOCARGTYPE u64 >>>=20 >>> /* >>> + * Stop the parser if an error occurs. This macro adds an >>> + * additional check that allows the parser to be stopped if any >>> + * error was noticed. >>> + */ >>> +#define PARSER_ERROR_CHECK && ! pParse->is_aborted >>=20 >> Any arguments in favour of using macro in this case? >> Why don=E2=80=99t simply inline this condition? >> The rest is OK as obvious. >>=20 > Currently, pParse is not used directly in a template (lempar.c). > I tried to keep this practice. OK, then LGTM.= --Apple-Mail=_48CE30EA-50A2-4C87-95D3-79334DFF9DBF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 15 May 2019, at 22:33, Imeev Mergen <imeevma@tarantool.org> wrote:
On 5/15/19 10:28 PM, n.pettik = wrote:

diff --git a/extra/lempar.c b/extra/lempar.c
index d043e39..595f89e = 100644
--- a/extra/lempar.c
+++ b/extra/lempar.c
@@ -935,7 +935,8 @@ void = Parse(
      yymajor =3D = YYNOCODE;
#endif
    }
-  }while( yymajor!=3DYYNOCODE && yypParser->yytos>yypParser->yystack = );
+  }while( yymajor!=3DYYNOCODE && = yypParser->yytos>yypParser->yystack
+ =         PARSER_ERROR_CHECK);
#ifndef NDEBUG
  if( yyTraceFILE = ){
    yyStackEntry= *i;
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 3a443a0..f241b8d = 100644
--- = a/src/box/sql/parse.y
+++ = b/src/box/sql/parse.y
@@ -80,6 +80,13 @@
#define YYMALLOCARGTYPE =  u64

/*
+ * Stop the parser if an error occurs. This macro adds an
+ * additional check that allows = the parser to be stopped if any
+ * error was noticed.
+ */
+#define PARSER_ERROR_CHECK && ! pParse->is_aborted

Any arguments in favour of using macro in this = case?
Why don=E2=80=99t simply inline this = condition?
The rest is OK as obvious.

Currently, pParse is not used directly in a template (lempar.c).
I tried to keep this practice.

OK, then = LGTM.
= --Apple-Mail=_48CE30EA-50A2-4C87-95D3-79334DFF9DBF--