[tarantool-patches] Re: [PATCH v1 1/1] sql: do not replace the error with a syntax error

n.pettik korablev at tarantool.org
Fri May 17 02:05:34 MSK 2019



> On 15 May 2019, at 22:33, Imeev Mergen <imeevma at 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 = 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.

OK, then LGTM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190517/1b7d5f43/attachment.html>


More information about the Tarantool-patches mailing list