Commit graph

325 commits

Author SHA1 Message Date
Nickolay Ponomarev
f31636d339 Simplify parse_window_frame
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.
2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
9314371d3b Remove parse_expr_list, as it's now trivial 2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
03efcf6fa6 Add parse_comma_separated to simplify the parser
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 ')')
2019-07-09 03:27:20 +03:00
Nikhil Benesch
ed76cd68f8
Merge pull request #124 from vemoo/impl-display
implement fmt::Display instead of ToString
2019-07-01 16:24:53 -04:00
Nickolay Ponomarev
7d4b488336 Update comments after the renaming done in PR #105 2019-07-01 04:45:08 +03:00
Bernardo
b2b159fed1 implement fmt::Display instead of ToString 2019-06-30 17:32:51 +02:00
Nikhil Benesch
106c9f8efb
Remove "SQL" prefix from "SQLDateTimeField" struct
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.
2019-06-25 13:24:31 -04:00
Nikhil Benesch
ac555d7e86
Remove "SQL" prefix from types
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".
2019-06-25 13:11:11 -04:00
Nikhil Benesch
cf655ad1a6
Remove "sql" prefix from module names
Since this crate only deals with SQL parsing, the modules are understood
to refer to SQL and don't need to restate that explicitly.
2019-06-24 12:56:26 -04:00
Andy Grove
0c23392adb replace with code from datafusion 2018-09-03 09:56:39 -06:00
Andy Grove
a86bd30515 Refactoring 2018-09-03 09:13:43 -06:00
Andy Grove
375671e208 Refactoring 2018-09-03 08:04:20 -06:00
Andy Grove
a1696ccdb8 Refactoring 2018-09-03 07:59:05 -06:00
Andy Grove
fa2ef528b7 Refactoring 2018-09-03 07:45:48 -06:00
Andy Grove
037ebb0f73 Refactoring 2018-09-02 19:15:07 -06:00
Andy Grove
2e20b15c2e Refactoring 2018-09-02 19:08:44 -06:00
Andy Grove
69a140a820 create Chars struct instead of using Peekable 2018-09-02 18:59:30 -06:00
Andy Grove
7ff4133327 Refactoring 2018-09-01 12:59:18 -06:00
Andy Grove
2ddc9f7a49 Refactoring 2018-09-01 08:58:00 -06:00
Andy Grove
72cff632c1 Roughing out pratt parser logic 2018-09-01 08:39:27 -06:00
Andy Grove
e6e9c8d2cc Refactoring use of generics, added peek_token 2018-09-01 08:11:26 -06:00
Andy Grove
eed0261297 create module for ansi tokenizer/parser 2018-09-01 07:34:41 -06:00
Andy Grove
0339558d4e Add most of the SQL:2011 data types 2018-09-01 06:51:00 -06:00
Andy Grove
f56846098e simple example of custom tokenizer 2018-02-09 06:53:49 -07:00
Andy Grove
fcf6b1150e save 2018-02-09 05:58:14 -07:00