It used to consume the `RParen` closing the encompassing `OVER (`, even
when no window frame was parsed, which confused me a bit, even though
I wrote it initially.
After fixing that, I took the opportunity to reduce nesting and
duplication a bit.
To use the new helper effectively, a few related changes were required:
- Each of the parse_..._list functions (`parse_cte_list`,
`parse_order_by_expr_list`, `parse_select_list`) was replaced with a
version that parses a single element of the list (e.g. `parse_cte`),
with their callers now using
`self.parse_comma_separated(Parser::parse_<one_element>)?`
- `parse_with_options` now parses the WITH keyword and a separate
`parse_sql_option` function (named after the struct it produces) was
added to parse a single k=v option.
- `parse_list_of_ids` is gone, with the '.'-separated parsing moved to
`parse_object_name`.
Custom comma-separated parsing is still used in:
- parse_transaction_modes (where the comma separator is optional)
- parse_columns (allows optional trailing comma, before the closing ')')
I realized a moment too late that I'd missed a type name in
when removing the "SQL" prefix from types in ac555d7e8. As far as I can
tell, this was the only oversight.
The rationale here is the same as the last commit: since this crate
exclusively parses SQL, there's no need to restate that in every type
name. (The prefix seems to be an artifact of this crate's history as a
submodule of Datafusion, where it was useful to explicitly call out
which types were related to SQL parsing.)
This commit has the additional benefit of making all type names
consistent; over type we'd added some types which were not prefixed with
"SQL".