mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Use Marker argument for item parsers
- Fix pub_expr - Fix incorrect parsing of crate::path
This commit is contained in:
parent
3d9c2beb8e
commit
76075c7410
14 changed files with 149 additions and 81 deletions
|
@ -86,7 +86,7 @@ impl BlockLike {
|
|||
}
|
||||
}
|
||||
|
||||
fn opt_visibility(p: &mut Parser) {
|
||||
fn opt_visibility(p: &mut Parser) -> bool {
|
||||
match p.current() {
|
||||
PUB_KW => {
|
||||
let m = p.start();
|
||||
|
@ -116,13 +116,19 @@ fn opt_visibility(p: &mut Parser) {
|
|||
}
|
||||
// test crate_keyword_vis
|
||||
// crate fn main() { }
|
||||
CRATE_KW => {
|
||||
// struct S { crate field: u32 }
|
||||
// struct T(crate u32);
|
||||
//
|
||||
// test crate_keyword_path
|
||||
// fn foo() { crate::foo(); }
|
||||
CRATE_KW if p.nth(1) != COLONCOLON => {
|
||||
let m = p.start();
|
||||
p.bump();
|
||||
m.complete(p, VISIBILITY);
|
||||
}
|
||||
_ => (),
|
||||
_ => return false,
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn opt_alias(p: &mut Parser) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue