D11888: Handle adjacent special characters correctly

Stefan BrĂ¼ns noreply at phabricator.kde.org
Wed Apr 4 04:28:10 UTC 2018


bruns added inline comments.

INLINE COMMENTS

> michaelh wrote in advancedqueryparser.cpp:69
> 1. I misunderstood your description as ':=' should become '='.
> 
> > The lexer should not handle ">" and ">=" differently, both are (valid) tokens, and should be returned as such.
> 
> That is what I meant. I was confused by `parse()` lexing again when encountering a '>'.
> 
> > Adding e.g. ">=" to the switch statement is not possible, as it works on QChar's.
> 
> I don't understand. token is QString. Why not instead of `switch (token.at(0).toLatin1())`
> 
>   switch (token) {
>   case '>'`: comparator = Term::Greater; break;
>   case '>='`: comparator = Term::GreaterEqual; break;
> 
> What am I missing?

> I don't understand. token is QString. Why not instead of switch (token.at(0).toLatin1())
> 
>   switch (token) {
>   case '>'`: comparator = Term::Greater; break;
>   case '>='`: comparator = Term::GreaterEqual; break;
> 
> 
> What am I missing?

You can only `switch` on integral statements (ints, chars, ...). With C++11, you can do some `constexpr` hacks, but your code won't work as is.

REPOSITORY
  R293 Baloo

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

To: bruns, #baloo, michaelh
Cc: #frameworks, ashaposhnikov, michaelh, astippich, spoorun, ngraham, alexeymin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180404/e1c533bc/attachment.html>


More information about the Kde-frameworks-devel mailing list