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 7ED872EB1C for ; Wed, 15 May 2019 15:28:57 -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 hV193bLiHWDu for ; Wed, 15 May 2019 15:28:57 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 162392EADA for ; Wed, 15 May 2019 15:28:56 -0400 (EDT) From: "n.pettik" Message-Id: <50DB5A78-5190-40D5-A3D6-2FFD7BA0A3E3@tarantool.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_70F04DE6-6D8C-419D-82BF-36027355CA42" 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: Wed, 15 May 2019 22:28:54 +0300 In-Reply-To: <20190515185225.GA21356@tarantool.org> References: <76ecaa6e2ba8a69f421a73bb25fb857cf5bbe001.1557244912.git.imeevma@gmail.com> <8D8884F5-961C-477F-B5AD-8723C0BBB674@tarantool.org> <20190515172839.GA10603@tarantool.org> <20190515185225.GA21356@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=_70F04DE6-6D8C-419D-82BF-36027355CA42 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 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 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. --Apple-Mail=_70F04DE6-6D8C-419D-82BF-36027355CA42 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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.

= --Apple-Mail=_70F04DE6-6D8C-419D-82BF-36027355CA42--