Ryo Yoshida
2a509d0eb2
Parse bare dyn types with leading lifetime
2023-05-05 04:30:37 +09:00
Lukas Wirth
d1ca505525
fix: Fix pat fragment handling in 2021 edition
2023-04-24 22:21:37 +02:00
bors
2400b36a2e
Auto merge of #14577 - jsoref:spelling, r=lnicola
...
Spelling
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling ).
The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796
The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293
closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce
Spelling
...
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
Ryo Yoshida
83a93f4bd3
Parse inline const pattern in nested patterns
2023-04-16 04:28:37 +09:00
Ryo Yoshida
89a1439de3
Parse exclusive range pattern
2023-04-16 04:28:29 +09:00
tamasfe
0b9c0c5088
feat(syntax): RTN in bounds
...
Limited syntactic support for experimental return type notations.
https://github.com/rust-lang/rust/issues/109417
2023-04-01 15:26:03 +02:00
Lukas Wirth
cb546390da
fix: Recover from pub()
visibility modifier
2023-03-30 13:42:15 +02:00
Laurențiu Nicola
dbf04a5ee2
⬆️ rust-analyzer
2023-03-20 08:31:01 +02:00
Lukas Wirth
55120b3d83
Add signature help for tuple struct patterns
2023-03-15 10:17:30 +01:00
Laurențiu Nicola
b2f6fd4f96
⬆️ rust-analyzer
2023-03-13 10:42:24 +02:00
XFFXFF
6e97527eae
add is_blocklike func on BlockLike
2023-03-07 17:27:52 +08:00
XFFXFF
98990affe5
add more tests
2023-03-07 08:24:25 +08:00
XFFXFF
995aacfce8
show diagnostic for } token followed by else in let else statement
2023-03-07 08:24:25 +08:00
Ryo Yoshida
2e7d2c2d04
Parse trait alias as a distinct AST type
2023-03-04 00:23:56 +09:00
shilangyu
44e47fe408
Add check for extra path segments after an angled one
2023-02-25 16:16:49 +01:00
Laurențiu Nicola
7e711da2f0
⬆️ rust-analyzer
2023-02-20 10:14:12 +02:00
Lukas Wirth
4f6b5f41d4
Recover better for more delimited sequences
2023-02-14 13:52:15 +01:00
Laurențiu Nicola
bc45c7659a
⬆️ rust-analyzer
2023-02-13 13:55:14 +02:00
Lukas Wirth
1be24e0899
internal: Improve parser recovery a bunch
2023-02-11 20:28:36 +01:00
Lukas Wirth
4788c7a056
Bump rustc-ap-rustc_lexer
2023-02-08 11:42:14 +01:00
Lukas Wirth
a756c9ad08
Fixup comments
2023-02-07 18:08:05 +01:00
Lukas Wirth
27cd509558
fix jointess for floats not being set properly
2023-02-07 17:41:16 +01:00
Lukas Wirth
f6539b139e
fix depth check for float split step
2023-02-07 15:44:00 +01:00
Lukas Wirth
c6e7917d6e
Fix up token_tree_to_syntax_node float split handling
2023-02-07 15:21:37 +01:00
Lukas Wirth
6fa6efe90f
fix: Fix parsing of nested tuple field accesses in a cursed way
2023-02-03 17:18:48 +01:00
Lukas Wirth
dab685dd87
De-magic number parser::Output encoding
2023-02-03 11:47:33 +01:00
onestacked
872408500b
Parse const_closures syntax.
...
Enables parsing of the syntax for `#![features(const_closures)]` introduced in https://github.com/rust-lang/rust/pull/106004
2023-01-19 15:40:07 +01:00
bors
fa874627f0
Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
...
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
Lukas Wirth
bed4db3c62
Use workspace.dependencies to declare local dependencies
2023-01-17 10:52:26 +01:00
Lukas Wirth
e4858fe480
Specify authors, edition and license via workspace.package
2023-01-16 16:44:00 +01:00
Lukas Wirth
679df2adf1
Specify rust-version via workspace.package
2023-01-16 16:33:01 +01:00
arcnmx
25242fe93f
⬆️ rust-analyzer
...
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
Daniel Eades
aa90d02079
remove useless operations
2023-01-02 15:02:54 +00:00
Daniel Eades
0a0817905e
return value directly from if/else block
2023-01-02 15:02:54 +00:00
Maybe Waffle
4a16afa264
Parse do yeet
expressions
2022-12-28 22:42:26 +00:00
Yuri Astrakhan
d3dbf9c194
Moar linting: needless_borrow, let_unit_value, ...
...
* There are a few needless borrows that don't seem to be needed. I even did a quick assembly comparison and posted a q to stackoveflow on it. See [here](https://stackoverflow.com/questions/74910196/advantages-of-pass-by-ref-val-with-impl-intoiteratoritem-impl-asrefstr )
* removed several `let _ = ...` when they don't look necessary (even a few ones that were not suggested by clippy (?))
* there were a few `then(|| ctor{})` that clippy suggested to replace with `then_some(ctor{})` -- seems reasonable?
* some unneeded assignment+return - keep the code a bit leaner
* a few `writeln!` instead of `write!`, or even consolidate write!
* a nice optimization to use `ch.is_ascii_digit` instead of `ch.is_digit(10)`
2022-12-25 05:07:47 -05:00
Yuri Astrakhan
e16c76e3c3
Inline all format arguments where possible
...
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.
The change was automatically created with, so there are far less change
of an accidental typo.
```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Yuri Astrakhan
1d59c7b667
Remove non-needed clones
...
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.
This was done with clippy, and manually reviewed:
```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
Jonas Schievink
c110481dd4
Reset parser step count when bumping
2022-12-19 16:27:00 +01:00
Dezhi Wu
258e532434
docs: update the comment and add a test to half_open_range_pat
2022-12-16 10:44:25 +08:00
Dezhi Wu
6a295fcd3b
fix: add a check for if
token in patterns parser
...
Closes #13776
2022-12-15 12:46:02 +08:00
Jonas Schievink
9e0aaf4cf3
Parse ..= X
patterns
2022-12-13 17:32:25 +01:00
Jonas Schievink
ed48bd8b9d
Fix parsing of _ = x
in closure body
2022-12-12 12:57:29 +01:00
Laurențiu Nicola
a2a1d99545
⬆️ rust-analyzer
2022-11-23 17:24:03 +02:00
Lukas Wirth
ffd7bf8bf9
Bump Cargo rust-version fields to latest stable
2022-11-07 12:59:51 +01:00
Laurențiu Nicola
65e1dc4d9c
⬆️ rust-analyzer
2022-09-06 21:20:49 +03:00
bors
93c52e41ec
Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink
...
fix: Parse TypePathFn with preceding `::`
e.g. `impl Fn::() -> ()`.
Fixes #13157 . This was the problem, not that the path was not at the end.
I could unify the parsing of `::` of TypePathFn with that of generic arg list, but some code relies on the `::` of generic arg list to be inside it.
2022-09-01 21:00:14 +00:00
Chayim Refael Friedman
d786a40e73
Parse TypePathFn with preceding ::
...
e.g. `impl Fn::() -> ()`.
2022-08-31 23:19:09 +00:00
bors
d9e22079c4
Auto merge of #12963 - DesmondWillowbrook:clippy-matches-sourcegen, r=Veykril
...
clippy: make generated code nice to read
Feel free to close if this is too minor.
(For context, I _have_ read the clippy policy in `dev/style.md`)
2022-08-31 08:37:14 +00:00
Laurențiu Nicola
3e358a6827
⬆️ rust-analyzer
2022-08-30 14:51:24 +03:00
Jonas Schievink
8969655ed6
Allow leading |
in more pattern positions
2022-08-23 16:31:59 +02:00
Laurențiu Nicola
8231fee466
⬆️ rust-analyzer
2022-08-16 11:24:50 +03:00
Lukas Wirth
49d24f639f
Recover from missing ellipsis in record literals for path expressions
2022-08-09 18:23:25 +02:00
Ryo Yoshida
b14062aaec
Parse range patterns in let statement with type annotation
2022-08-09 00:00:22 +09:00
Kartavya Vashishtha
bcab4be938
regenerate files with new syntax
2022-08-07 17:38:20 +05:30
Ryo Yoshida
a81c7a2974
Parse range patterns in struct and slice without trailing comma
2022-08-07 17:19:15 +09:00
Laurențiu Nicola
9d2cb42a41
⬆️ rust-analyzer
2022-08-02 09:05:16 +03:00
cynecx
902fd6ddcd
fix: complete path of existing record expr
2022-07-29 17:24:05 +02:00
Amos Wenger
7e285e1ef5
Run cargo fmt
2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094
Enable extra warnings required by rust-lang/rust
2022-07-20 15:00:17 +02:00
Amos Wenger
1b416473a3
Upgrade to expect-test@1.4.0
...
cf. https://github.com/rust-analyzer/expect-test/issues/33
cf. https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19 13:00:45 +02:00
Jonas Schievink
6c6ae965ba
Update remaining GitHub URLs
2022-07-08 15:44:49 +02:00
Lukas Wirth
76ae5434fa
internal: Bump Dependencies
2022-06-10 17:30:02 +02:00
XFFXFF
df67bbdcb3
fix: parsing of ?
opt-out trait bounds
...
thanks to Veykril
2022-06-02 21:30:18 +08:00
Jonas Schievink
9bd11459ba
Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
...
This reverts commit cc9ae2b89e
, reversing
changes made to 7dfd1cb572
.
2022-05-13 15:08:14 +02:00
Jonas Schievink
4fcdb96789
Revert "fix: Remap float parts as integers when parsed as indices"
...
This reverts commit dbb066b99e
.
2022-05-13 15:05:03 +02:00
Jonas Schievink
73e0e17b52
Revert "Don't remap float tokens to INT_NUMBER
"
...
This reverts commit cb5e8da88a
.
2022-05-13 15:04:36 +02:00
Jonas Schievink
cb5e8da88a
Don't remap float tokens to INT_NUMBER
2022-05-12 19:01:09 +02:00
Lukas Wirth
dbb066b99e
fix: Remap float parts as integers when parsed as indices
2022-05-07 12:52:15 +02:00
Jonas Schievink
37443eb9a1
Maybe everything else *should* have to deal with it
2022-05-05 16:28:59 +02:00
Jonas Schievink
2fe38d3b63
Indicate the number of float tokens in the first token
2022-05-05 16:28:59 +02:00
Jonas Schievink
34dc8e9383
Wrap floats in token trees in FLOAT_LITERAL
node
2022-05-05 16:28:59 +02:00
Jonas Schievink
2a755495d0
Add tests
2022-05-05 16:28:59 +02:00
Jonas Schievink
1bc3305d95
Split float literal tokens at the .
2022-05-05 16:28:58 +02:00
Jonas Schievink
502c519e7d
Wrap float literals in their own node
2022-05-05 16:28:14 +02:00
Jonas Schievink
1f50e19eb2
Add a Converter
type for token conversion
2022-05-02 17:47:12 +02:00
Lukas Wirth
e2344e78f3
fix: Use pattern recovery set when parsing ident patterns
2022-04-27 19:08:50 +02:00
XFFXFF
6580d75308
update parser to support associated const equality
2022-04-17 20:26:06 +08:00
Lukas Wirth
d8341c5b92
Parse for<'a> closure syntax
2022-04-10 17:50:14 +02:00
Jonas Schievink
872b7b9660
Wrap macros in expr position in MacroExpr
node
2022-04-05 17:43:34 +02:00
hkalbasi
049f0a6d2c
recover from missing type annotation
2022-04-01 17:20:54 +04:30
Jonas Schievink
42ecf406e8
Remove parser restriction on varargs positioning
2022-03-31 16:03:27 +02:00
Lukas Wirth
8e91bb7660
minor: Bump dependencies
2022-03-22 17:42:24 +01:00
Steven Joruk
8a28430676
refactor: Rename and move const_arg_path
...
It wasn't testing the `const_arg` code path, it was actually hitting
const_param's default value code path, so move it to the right place
and rename it.
2022-03-11 22:28:38 +00:00
Steven Joruk
e84453c47f
refactor: Rename const_arg_content to const_arg_expr
2022-03-11 22:28:35 +00:00
Steven Joruk
972f50da2d
fix: Stop wrapping ConstParam's default values in ConstArg
...
This was causing ConstParam::default_val to always return None for block
expressions.
CONST_ARG@24..29
BLOCK_EXPR@24..29
...
2022-03-11 19:51:35 +00:00
Dario Nieuwenhuis
49d1207775
Add support for new where
clause location in associated types.
...
A recent Rust nightly changed it: https://github.com/rust-lang/rust/issues/89122
This allows both the old and new location.
2022-03-10 18:21:29 +01:00
Aleksey Kladov
cf70ed5eac
Bring back syntax highlighting in test data
...
cc #11597
2022-03-06 08:43:18 +00:00
Lukas Wirth
c0d6471143
fix: Recognize Self
as a proper keyword
2022-03-05 23:20:06 +01:00
Chayim Refael Friedman
d9f0731bd2
Parse destructuring assignment
...
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
2022-03-02 01:51:25 +00:00
Chayim Refael Friedman
a1b7169b48
Update tests
...
Unfortunately, we lost some recovery for expressions.
2022-02-21 08:34:35 +02:00
Chayim Refael Friedman
de8633f15f
Parse let
expressions in order to support let
chains
...
We still need to reject freestanding `let` expressions: see https://github.com/rust-analyzer/rust-analyzer/issues/11320#issuecomment-1018212465 .
2022-02-21 08:34:34 +02:00
bellau
06452cd102
Fix style
2022-02-14 07:41:50 +01:00
bellau
dc68b89469
oops, remove println
2022-02-13 09:11:35 +01:00
bellau
0a18a050b5
fix handle static async and static async move
2022-02-13 09:09:44 +01:00
bellau
3ed19d54db
Fix style
2022-02-12 17:31:17 +01:00
bellau
2008607946
support static move too
2022-02-12 16:07:58 +01:00
bellau
1284bc0af3
Fix styles
2022-02-12 15:35:06 +01:00
bellau
ccab6afabc
Fix Immovable generator syntax (static ||) not recognized #11448
2022-02-12 15:17:10 +01:00
Jonas Schievink
8a7f0d920e
Allow macros to expand to or-patterns
2022-01-17 16:52:53 +01:00
Aleksey Kladov
2e34a5e2e9
add empty input tests
2022-01-02 18:50:32 +03:00
Aleksey Kladov
c72908a201
more intuitive order
2022-01-02 18:46:01 +03:00
Aleksey Kladov
d846afdeef
check top level entry point invariants
2022-01-02 18:41:32 +03:00
Aleksey Kladov
fa049d94d1
add top-level tests for expressions
2022-01-02 17:52:05 +03:00
Aleksey Kladov
640cc27ff0
add top level tests for types
2022-01-02 17:45:18 +03:00
Aleksey Kladov
e78424846e
enforce parsing invariant for patterns
2022-01-02 17:32:15 +03:00
Aleksey Kladov
7989d567e2
internal: more macro tests
2022-01-02 17:18:21 +03:00
Aleksey Kladov
7de4b964a9
add test for macro items
2022-01-02 16:48:10 +03:00
Aleksey Kladov
bebfb83fd0
split prefix/top tests
2022-01-02 15:18:34 +03:00
Aleksey Kladov
2bd7c74706
add tests for macro statements
2022-01-02 15:17:32 +03:00
Aleksey Kladov
f2ea7853ee
start top-level entry point tests
2022-01-02 15:15:04 +03:00
Aleksey Kladov
e366b3c730
minor: generalize
2022-01-02 15:01:20 +03:00
Aleksey Kladov
e36f557e4d
internal: add more prefix entry point tests
2022-01-01 20:04:09 +03:00
Aleksey Kladov
7c4276b3e1
add path tests
2022-01-01 19:02:47 +03:00
Aleksey Kladov
287e748aa9
add expr tests
2022-01-01 18:58:30 +03:00
Aleksey Kladov
58fa7ce782
tests for ty
2022-01-01 18:58:30 +03:00
Aleksey Kladov
5ca83a5fb3
internal: add tests for patterns
2022-01-01 18:58:30 +03:00
Aleksey Kladov
2f3237912d
restore invariatns
2021-12-29 20:37:08 +03:00
Aleksey Kladov
b5369927d7
parse empty statemet as statemetn
2021-12-29 20:04:36 +03:00
Aleksey Kladov
f5cfc0504e
rename
2021-12-29 19:18:34 +03:00
Aleksey Kladov
8234a85d15
compress
2021-12-29 18:51:05 +03:00
Aleksey Kladov
3f5fc05d66
internal: add tests for extra parser entry points
2021-12-29 18:28:11 +03:00
Aleksey Kladov
660cf34d8c
dead code
2021-12-28 19:13:30 +03:00
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
Aramis Razzaghipour
eff195852d
Fix miscellaneous Clippy lints
2021-10-03 23:53:30 +11:00
Aramis Razzaghipour
55c0b86cde
Add semicolons for consistency
...
`clippy::semicolon_if_nothing_returned`
2021-10-03 23:39:43 +11:00
zhoufan
116c7aef7f
move outer_attrs call before the match
2021-10-03 09:22:02 +08:00
Aleksey Kladov
393f80e036
minor
2021-10-02 13:20:45 +03:00
zhoufan
0ee6b70b34
Parse outer attributes on StructPatternEtCetera
2021-10-02 09:57:44 +08:00
Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
Aleksey Kladov
56964c9bd3
feat: allow attributes on all expressions
...
Attrs are syntactically valid on any expression, even if they are not
allowed semantically everywhere yet.
2021-09-25 22:19:27 +03:00
Aleksey Kladov
7dc331faef
fix: correct extend_to logic in parser
...
Previously we swapped to events in the buffer, but that might be wrong
if there aer `forward_parent` links pointing to the swapped-out node.
Let's do the same via parent links instead, keeping the nodes in place
2021-09-25 22:09:50 +03:00
Aleksey Kladov
6997adfee7
simplify attribute parsing
2021-09-25 18:07:51 +03:00
Aleksey Kladov
f27cda6865
minor: more condensed tests
2021-09-25 14:24:57 +03:00
Aleksey Kladov
f692be853b
minor: link my own pratt parsing article :-)
2021-09-25 14:20:34 +03:00
Aleksey Kladov
1567bbb73e
minor: more focusted tests
2021-09-25 14:04:27 +03:00
Aleksey Kladov
a6f17f7436
minor: more readable code
2021-09-25 13:27:53 +03:00
Aleksey Kladov
a6181bfdb7
internal: more focused tests for const arguments
2021-09-19 16:35:10 +03:00
Aleksey Kladov
09531b703d
minor: simplify
2021-09-19 14:50:53 +03:00
Aleksey Kladov
0005678649
minor: simplify
2021-09-19 14:26:35 +03:00
Aleksey Kladov
f99bdf4cc0
fix: don't allow two turbo-fishes in generic arguments
2021-09-19 12:09:50 +03:00
Aleksey Kladov
8009ccc27d
minor: improve readability
2021-09-19 11:34:25 +03:00
Aleksey Kladov
25adc5e9f0
minor: reduce duplication
2021-09-19 11:19:31 +03:00
Aleksey Kladov
fbb6a6a95b
fix: correctly handle jointness
2021-09-18 16:09:12 +03:00
Aleksey Kladov
c0556bd8c1
minor: improve readability
2021-09-18 15:56:26 +03:00
Aleksey Kladov
ed84717869
internal: better naming
2021-09-18 15:55:07 +03:00
Aleksey Kladov
3dc2aeea0f
internal: parser cleanup
2021-09-18 15:46:28 +03:00
Aleksey Kladov
af9fd37cd9
internal: minimize use_tree parser tests
...
The code here is intentionally dense and does exactly what is written.
Explaining semantic difference between Rust 2015 and 2018 doesn't help
with understanding syntax. Better to just add more targeted tests.
2021-09-18 15:22:49 +03:00
Aleksey Kladov
1d2e9818d6
internal: parser cleanups
2021-09-18 14:53:46 +03:00