Commit Graph

177 Commits

Author SHA1 Message Date
Aleksey Kladov
f0fefde401 remove Item::parse 2021-12-28 17:00:55 +03:00
Aleksey Kladov
b468bd6645 internal: start isolating ssr-related parsing APIs to SSR 2021-12-28 17:00:55 +03:00
Aleksey Kladov
8794892432 dead code 2021-12-28 17:00:55 +03:00
Aleksey Kladov
afffa096f6 add TopEntryPoint 2021-12-28 17:00:55 +03:00
Aleksey Kladov
8e7fc7be65 simplify 2021-12-28 17:00:55 +03:00
Aleksey Kladov
369001615f move path 2021-12-28 17:00:55 +03:00
Aleksey Kladov
c5d8a9b341 move expr 2021-12-28 17:00:55 +03:00
Aleksey Kladov
04ae18de29 move ty 2021-12-28 17:00:55 +03:00
Aleksey Kladov
5636bef2ec move pat to prefix entry points 2021-12-28 17:00:55 +03:00
Aleksey Kladov
f10f51833c move stmt to entry points 2021-12-28 17:00:55 +03:00
Aleksey Kladov
519ee21bcb internal: move block to prefix entry point 2021-12-28 17:00:55 +03:00
Aleksey Kladov
350d5dc152 internal: move visibility to a prefix entry point 2021-12-28 17:00:55 +03:00
Aleksey Kladov
abc658aad0 internal: add prefix entry points 2021-12-28 17:00:55 +03:00
Aleksey Kladov
8e9734e18f fix line endings 2021-12-26 18:46:21 +03:00
Aleksey Kladov
b360ea91f2 internal: move inline parser tests to parser crate 2021-12-26 18:19:09 +03:00
Aleksey Kladov
0f74758fea internal: move outlined parser tests 2021-12-26 17:58:33 +03:00
Aleksey Kladov
f4cb0ff9be internal: move ws attachment logic to the parser crate
This has to re-introduce the `sink` pattern, because doing this purely
with iterators is awkward :( Maaaybe the event vector was a false start?

But, anyway, I like the current factoring more -- it sort-of obvious
that we do want to keep ws-attachment business in the parser, and that
we also don't want that to depend on the particular tree structure. I
think `shortcuts` module achieves that.
2021-12-26 16:47:10 +03:00
Aleksey Kladov
74de79b1da internal: rename 2021-12-25 22:02:26 +03:00
Aleksey Kladov
d0d05075ed internal: replace TreeSink with a data structure
The general theme of this is to make parser a better independent
library.

The specific thing we do here is replacing callback based TreeSink with
a data structure. That is, rather than calling user-provided tree
construction methods, the parser now spits out a very bare-bones tree,
effectively a log of a DFS traversal.

This makes the parser usable without any *specifc* tree sink, and allows
us to, eg, move tests into this crate.

Now, it's also true that this is a distinction without a difference, as
the old and the new interface are equivalent in expressiveness. Still,
this new thing seems somewhat simpler. But yeah, I admit I don't have a
suuper strong motivation here, just a hunch that this is better.
2021-12-25 22:02:26 +03:00
bors[bot]
f46731a230
Merge #11028
11028: Bump MSRV (1.57) r=Veykril a=iDawer

This bumps MSRV on all crates to 1.57 except `la-arena`

#10986 requires >=1.57 

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
Aleksey Kladov
92dad471bc
Update crates/parser/src/lexed_str.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-12-18 17:34:55 +03:00
Aleksey Kladov
a022ad68c9 internal: move all the lexing to the parser crate 2021-12-18 17:20:38 +03:00
Aleksey Kladov
78926027e3 converting lexed str to tokens 2021-12-18 15:36:21 +03:00
Aleksey Kladov
8b9d145dea soa all the things 2021-12-18 15:31:50 +03:00
Aleksey Kladov
799941e05e move tests 2021-12-18 14:55:20 +03:00
Aleksey Kladov
7e99864dbf move lexing to the parser crate 2021-12-18 14:55:20 +03:00
iDawer
676744be6e Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
Aleksey Kladov
3b5b988526 prettyfy 2021-12-12 19:36:14 +03:00
Aleksey Kladov
980dd56cdc consistency 2021-12-12 19:32:04 +03:00
Aleksey Kladov
6e4bb57014 simplify 2021-12-12 19:31:32 +03:00
Aleksey Kladov
57e6ef0bfb tighten up invariants 2021-12-12 19:22:37 +03:00
Aleksey Kladov
18d4737fb9 add cross-crate inlines 2021-12-12 19:17:04 +03:00
Aleksey Kladov
1055a6111a port mbe to soa tokens 2021-12-12 19:06:40 +03:00
Aleksey Kladov
965585748e more orthogonal interface 2021-12-12 18:38:49 +03:00
Aleksey Kladov
6ce587ba5a parser tests work 2021-12-12 18:31:05 +03:00
Aleksey Kladov
26bfd6023f Switch parser to use tokens 2021-12-12 16:54:09 +03:00
Aleksey Kladov
d5ad0f3ca0 use eof token pattenr 2021-12-12 16:54:09 +03:00
Aleksey Kladov
addfd8d9e8 start SOA parser interface 2021-12-12 16:54:09 +03:00
Laurențiu Nicola
f5db6e0e95 Bump parser step limit a little 2021-12-06 11:47:36 +02:00
zhoufan
a539b5e693 fix: parse the range pat inside the tuple pat 2021-11-18 11:11:37 +08:00
Adam Bratschi-Kaye
0d54754ca7 Handle pub tuple fields in tuple structs
The current implementation will throw a parser error for tuple structs
that contain a pub tuple field. For example,
```rust
struct Foo(pub (u32, u32));
```
is valid Rust, but rust-analyzer will throw a parser error.  This is
because the parens after `pub` is treated as a visibility context.
Allowing a tuple type to follow `pub` in the special case when we are
defining fields in a tuple struct can fix the issue.
2021-11-10 21:29:50 +01:00
Aleksey Kladov
485c5e6717 internal: remove unused dollars 2021-10-23 20:44:35 +03:00
Laurențiu Nicola
8457ae34bd Set MSRV 2021-10-23 15:07:11 +03:00
Lukas Wirth
1294bfce86 Migrate to edition 2021 2021-10-21 20:10:40 +02:00
Lukas Wirth
b219a4c465 internal: Parse const trait bounds 2021-10-19 14:20:00 +02:00
Jonas Schievink
f8acae7895 Support let...else 2021-10-07 17:06:24 +02:00
cynecx
07cd19dcef parser: fix parsing of macro call inside generic args 2021-10-06 22:41:35 +02:00
bors[bot]
94fa49c0a3
Merge #10420
10420: Parse outer attributes on StructPatternEtCetera r=jonas-schievink a=XFFXFF

Try to fix https://github.com/rust-analyzer/rust-analyzer/issues/8610  
Related pr in ungrammer: https://github.com/rust-analyzer/ungrammar/pull/41

Co-authored-by: zhoufan <1247714429@qq.com>
2021-10-06 15:05:40 +00:00
bors[bot]
86c534f244
Merge #10440
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg

I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159)), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.

I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.

Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05 08:58:40 +00:00
zhoufan
a248f39cb4 make Some(1..) parsed 2021-10-04 17:33:48 +08:00