D29327: Improve a bit parse error dignosis

Jarosław Staniek noreply at phabricator.kde.org
Sun May 3 13:20:36 BST 2020


staniek added inline comments.

INLINE COMMENTS

> jfita wrote in KDbSqlScanner.l:164
> The problem i had quoting the unexpected character is that, depending on the font settings, it can be very hard to spot what is the offending character when it is a symbol like ' or ". For example, in the following screenshot i have problems seeing the ' character in "'":
> 
> F8278446: ambiguous-character-error.png <https://phabricator.kde.org/F8278446>
> 
> Having the character alone at the end removes that kind of problems:
> 
> F8278449: clearer-character-error.png <https://phabricator.kde.org/F8278449>
> 
> Do you want me to keep the quotes around the character?

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));

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/50b1ad04/attachment.html>


More information about the Kexi-devel mailing list