D29327: Improve a bit parse error diagnosis

jordi fita i mas noreply at phabricator.kde.org
Sun May 3 21:38:28 BST 2020


jfita added inline comments.

INLINE COMMENTS

> staniek wrote in KDbSqlScanner.l:164
> That's a good note.
> 
> How about doing the same as a compiler shows:
> 
> when there's a quote it shows  just it, e.g:'
> 
>   error: missing terminating " character
> 
> else, it shows like
> 
>   error: unknown type name 'a'
> 
> So we could do:
> 
>   const QString string(QString::fromUtf8(yytext, yyleng));
>   QString char(string.left(1));
>   if (char == QLatin1Char('\'') || char == QLatin1Char('"') || char == QLatin1Char('`')) {
>   } else {
>     char = QString("\"%1\").arg(char);
>   }
>   
>   setError(KDbParser::tr("Unexpected character %1 in date/time").arg(char));

> So we could do:
> 
>   const QString string(QString::fromUtf8(yytext, yyleng));
>   QString char(string.left(1));
>   if (char == QLatin1Char('\'') || char == QLatin1Char('"') || char == QLatin1Char('`')) {
>   } else {
>    char = QString("\"%1\").arg(char);
>   }

I’ve put that code into a function so that i could reuse in both error conditions and changed the message to what you suggested.

REPOSITORY
  R15 KDb

REVISION DETAIL
  https://phabricator.kde.org/D29327

To: jfita, staniek, piggz
Cc: Kexi-Devel-list, barman, wicik, staniek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kexi-devel/attachments/20200503/3988eccf/attachment.html>


More information about the Kexi-devel mailing list