search: improve literal parentheses interpretation
Created by: rvantonder
Previously a literal pattern like repo:foo Args or main)
wouldn't work as expected. This was interpreted as "Args" or (concat "main" ")")
, and concat implies a space separation, meaning "main )"
instead of "main)"
. Instead, the intuitive interpretation is that the dangling right parenthesis should be merged above, to be "main)"
, which is what this PR does.
We cannot always interpret things in this natural way: there simply are ambiguous cases that are currently too tricky to handle once such a pattern is combined with groups, like (respObj.Size and (data)))
(is the second to last parenthesis trying to close the group, and a typo happened? or is the second pattern intentionally meant to be (data))
?). For such tricky cases we just return a friendly error message for now. In future we can consider suggestions.