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 5D4832C7A3 for ; Wed, 15 May 2019 15:33:23 -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 eIBa6sxpuoKR for ; Wed, 15 May 2019 15:33:23 -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 BD9E32BE21 for ; Wed, 15 May 2019 15:33:22 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: do not replace the error with a syntax error 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> From: Imeev Mergen Message-ID: <114523ac-bf18-097d-fcd4-9cead7027b43@tarantool.org> Date: Wed, 15 May 2019 22:33:21 +0300 MIME-Version: 1.0 In-Reply-To: <50DB5A78-5190-40D5-A3D6-2FFD7BA0A3E3@tarantool.org> Content-Type: multipart/alternative; boundary="------------90EF333B59FBD6D45F49FB95" Content-Language: en-US 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: "n.pettik" , tarantool-patches@freelists.org This is a multi-part message in MIME format. --------------90EF333B59FBD6D45F49FB95 Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit 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 = YYNOCODE; >> #endif >>     } >> -  }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); >> +  }while( yymajor!=YYNOCODE && 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’t 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. --------------90EF333B59FBD6D45F49FB95 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit


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 = YYNOCODE;
#endif
    }
-  }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
+  }while( yymajor!=YYNOCODE && 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’t 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.
--------------90EF333B59FBD6D45F49FB95--