aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/grammar/expressions/mod.rs16
-rw-r--r--src/grammar/items/mod.rs6
2 files changed, 16 insertions, 6 deletions
diff --git a/src/grammar/expressions/mod.rs b/src/grammar/expressions/mod.rs
index 6831aef66..15669f99d 100644
--- a/src/grammar/expressions/mod.rs
+++ b/src/grammar/expressions/mod.rs
@@ -202,16 +202,22 @@ fn arg_list(p: &mut Parser) {
202// let _ = a; 202// let _ = a;
203// let _ = a::b; 203// let _ = a::b;
204// let _ = ::a::<b>; 204// let _ = ::a::<b>;
205// let _ = format!();
205// } 206// }
206fn path_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { 207fn path_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker {
207 assert!(paths::is_path_start(p)); 208 assert!(paths::is_path_start(p));
208 let m = p.start(); 209 let m = p.start();
209 paths::expr_path(p); 210 paths::expr_path(p);
210 if p.at(L_CURLY) && !r.forbid_structs { 211 match p.current() {
211 struct_lit(p); 212 L_CURLY if !r.forbid_structs => {
212 m.complete(p, STRUCT_LIT) 213 struct_lit(p);
213 } else { 214 m.complete(p, STRUCT_LIT)
214 m.complete(p, PATH_EXPR) 215 }
216 EXCL => {
217 items::macro_call_after_excl(p);
218 m.complete(p, MACRO_CALL)
219 }
220 _ => m.complete(p, PATH_EXPR)
215 } 221 }
216} 222}
217 223
diff --git a/src/grammar/items/mod.rs b/src/grammar/items/mod.rs
index 8f766901e..657078765 100644
--- a/src/grammar/items/mod.rs
+++ b/src/grammar/items/mod.rs
@@ -277,7 +277,7 @@ fn mod_item(p: &mut Parser) {
277 } 277 }
278} 278}
279 279
280enum MacroFlavor { 280pub(super) enum MacroFlavor {
281 Curly, 281 Curly,
282 NonCurly, 282 NonCurly,
283} 283}
@@ -285,6 +285,10 @@ enum MacroFlavor {
285fn macro_call(p: &mut Parser) -> MacroFlavor { 285fn macro_call(p: &mut Parser) -> MacroFlavor {
286 assert!(paths::is_path_start(p)); 286 assert!(paths::is_path_start(p));
287 paths::use_path(p); 287 paths::use_path(p);
288 macro_call_after_excl(p)
289}
290
291pub(super) fn macro_call_after_excl(p: &mut Parser) -> MacroFlavor {
288 p.expect(EXCL); 292 p.expect(EXCL);
289 p.eat(IDENT); 293 p.eat(IDENT);
290 let flavor = match p.current() { 294 let flavor = match p.current() {