diff options
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/grammar/mod.rs | 10 | ||||
-rw-r--r-- | src/parser/grammar/paths.rs | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index 6e82d7c69..abf9fe86c 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs | |||
@@ -60,6 +60,16 @@ fn name(p: &mut Parser) { | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | fn name_ref(p: &mut Parser) { | ||
64 | if p.at(IDENT) { | ||
65 | let m = p.start(); | ||
66 | p.bump(); | ||
67 | m.complete(p, NAME_REF); | ||
68 | } else { | ||
69 | p.error("expected identifier"); | ||
70 | } | ||
71 | } | ||
72 | |||
63 | fn error_block(p: &mut Parser, message: &str) { | 73 | fn error_block(p: &mut Parser, message: &str) { |
64 | assert!(p.at(L_CURLY)); | 74 | assert!(p.at(L_CURLY)); |
65 | let err = p.start(); | 75 | let err = p.start(); |
diff --git a/src/parser/grammar/paths.rs b/src/parser/grammar/paths.rs index a7fc90774..6ed315c3d 100644 --- a/src/parser/grammar/paths.rs +++ b/src/parser/grammar/paths.rs | |||
@@ -42,7 +42,8 @@ fn path_segment(p: &mut Parser, first: bool) { | |||
42 | p.eat(COLONCOLON); | 42 | p.eat(COLONCOLON); |
43 | } | 43 | } |
44 | match p.current() { | 44 | match p.current() { |
45 | IDENT | SELF_KW | SUPER_KW => p.bump(), | 45 | IDENT => name_ref(p), |
46 | SELF_KW | SUPER_KW => p.bump(), | ||
46 | _ => { | 47 | _ => { |
47 | p.error("expected identifier"); | 48 | p.error("expected identifier"); |
48 | } | 49 | } |