query: handle parse function not consuming all of input (#569)
Previously we silently ignored it. For example a search like `(foo))`
would just work since we would only parse `(foo)`. We now report back to
the user the problem.
Note: we already had special handling for unbalanced parenthesis like
this `((foo)`.
Test Plan: added more test cases. Especially tried to explore areas we
could validly not consume the whole input but couldn't find one.