search: add smart paren handling for and/or queries
Created by: rvantonder
This is part 1 for adding better default paren handling in and/or
queries. There are cases where parens grouping syntax doesn't gain anything for and/or
queries, but takes away convenience from other searches. Examples:
-
foo(bar|baz)
<- Here we want to preserve parentheses as part of a regexp search pattern, not treat it as an expression grouping -
func main(:[args])
<- Here we want to treat parentheses literally as part of a structural search pattern.
Note that both of the above can be expressed by quoting, say. But it's much more convenient and natural to specify these patterns, which are obviously not and/or expressions, without quotes for each respective mode.
This PR is part 1 of smarter parentheses that doesn't handle whitespace. There will be a part 2.