diff options
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r-- | crates/libsyntax2/src/grammar/items/mod.rs | 2 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/items/use_item.rs | 2 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/mod.rs | 8 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/params.rs | 8 |
4 files changed, 11 insertions, 9 deletions
diff --git a/crates/libsyntax2/src/grammar/items/mod.rs b/crates/libsyntax2/src/grammar/items/mod.rs index c74266133..d460612b4 100644 --- a/crates/libsyntax2/src/grammar/items/mod.rs +++ b/crates/libsyntax2/src/grammar/items/mod.rs | |||
@@ -208,7 +208,7 @@ fn extern_crate_item(p: &mut Parser) { | |||
208 | assert!(p.at(CRATE_KW)); | 208 | assert!(p.at(CRATE_KW)); |
209 | p.bump(); | 209 | p.bump(); |
210 | name(p); | 210 | name(p); |
211 | alias(p); | 211 | opt_alias(p); |
212 | p.expect(SEMI); | 212 | p.expect(SEMI); |
213 | } | 213 | } |
214 | 214 | ||
diff --git a/crates/libsyntax2/src/grammar/items/use_item.rs b/crates/libsyntax2/src/grammar/items/use_item.rs index a3f7f0da8..3da40a629 100644 --- a/crates/libsyntax2/src/grammar/items/use_item.rs +++ b/crates/libsyntax2/src/grammar/items/use_item.rs | |||
@@ -26,7 +26,7 @@ fn use_tree(p: &mut Parser) { | |||
26 | paths::use_path(p); | 26 | paths::use_path(p); |
27 | match p.current() { | 27 | match p.current() { |
28 | AS_KW => { | 28 | AS_KW => { |
29 | alias(p); | 29 | opt_alias(p); |
30 | } | 30 | } |
31 | COLONCOLON => { | 31 | COLONCOLON => { |
32 | p.bump(); | 32 | p.bump(); |
diff --git a/crates/libsyntax2/src/grammar/mod.rs b/crates/libsyntax2/src/grammar/mod.rs index bbdc4f807..d09a9dc9c 100644 --- a/crates/libsyntax2/src/grammar/mod.rs +++ b/crates/libsyntax2/src/grammar/mod.rs | |||
@@ -92,14 +92,14 @@ fn opt_visibility(p: &mut Parser) { | |||
92 | _ => (), | 92 | _ => (), |
93 | } | 93 | } |
94 | } | 94 | } |
95 | fn alias(p: &mut Parser) -> bool { | 95 | |
96 | fn opt_alias(p: &mut Parser) { | ||
96 | if p.at(AS_KW) { | 97 | if p.at(AS_KW) { |
97 | let alias = p.start(); | 98 | let m = p.start(); |
98 | p.bump(); | 99 | p.bump(); |
99 | name(p); | 100 | name(p); |
100 | alias.complete(p, ALIAS); | 101 | m.complete(p, ALIAS); |
101 | } | 102 | } |
102 | true //FIXME: return false if three are errors | ||
103 | } | 103 | } |
104 | 104 | ||
105 | fn abi(p: &mut Parser) { | 105 | fn abi(p: &mut Parser) { |
diff --git a/crates/libsyntax2/src/grammar/params.rs b/crates/libsyntax2/src/grammar/params.rs index 7e58e8713..47567ec8a 100644 --- a/crates/libsyntax2/src/grammar/params.rs +++ b/crates/libsyntax2/src/grammar/params.rs | |||
@@ -92,16 +92,18 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
92 | // fn b(&self,) {} | 92 | // fn b(&self,) {} |
93 | // fn c(&'a self,) {} | 93 | // fn c(&'a self,) {} |
94 | // fn d(&'a mut self, x: i32) {} | 94 | // fn d(&'a mut self, x: i32) {} |
95 | // fn e(mut self) {} | ||
95 | // } | 96 | // } |
96 | fn self_param(p: &mut Parser) { | 97 | fn self_param(p: &mut Parser) { |
97 | let m; | 98 | let m; |
98 | if p.at(SELF_KW) { | 99 | if p.at(SELF_KW) || p.at(MUT_KW) && p.nth(1) == SELF_KW { |
99 | m = p.start(); | 100 | m = p.start(); |
100 | p.bump(); | 101 | p.eat(MUT_KW); |
102 | p.eat(SELF_KW); | ||
101 | // test arb_self_types | 103 | // test arb_self_types |
102 | // impl S { | 104 | // impl S { |
103 | // fn a(self: &Self) {} | 105 | // fn a(self: &Self) {} |
104 | // fn b(self: Box<Self>) {} | 106 | // fn b(mut self: Box<Self>) {} |
105 | // } | 107 | // } |
106 | if p.at(COLON) { | 108 | if p.at(COLON) { |
107 | types::ascription(p); | 109 | types::ascription(p); |