aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-13 08:55:03 +0000
committerAleksey Kladov <[email protected]>2018-01-13 08:55:03 +0000
commit29b2e0adcc35834dda2884222624bfcc268a3eff (patch)
tree0838a22c27bba0361dcde3660075175f243a4d7a /src/parser
parentf31d85860771b0c4c8d232d79e4a3489a051ba9d (diff)
G: allow self & super in paths
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/event_parser/grammar/paths.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs
index 108545bc2..d6887a9ba 100644
--- a/src/parser/event_parser/grammar/paths.rs
+++ b/src/parser/event_parser/grammar/paths.rs
@@ -1,7 +1,7 @@
1use super::*; 1use super::*;
2 2
3pub(crate) fn use_path(p: &mut Parser) { 3pub(crate) fn use_path(p: &mut Parser) {
4 if !AnyOf(&[IDENT, COLONCOLON]).is_ahead(p) { 4 if !AnyOf(&[IDENT, SELF_KW, SUPER_KW, COLONCOLON]).is_ahead(p) {
5 return; 5 return;
6 } 6 }
7 let mut prev = p.mark(); 7 let mut prev = p.mark();
@@ -23,6 +23,15 @@ fn path_segment(p: &mut Parser, first: bool) {
23 if first { 23 if first {
24 p.eat(COLONCOLON); 24 p.eat(COLONCOLON);
25 } 25 }
26 p.expect(IDENT); 26 match p.current() {
27 IDENT | SELF_KW | SUPER_KW => {
28 p.bump();
29 },
30 _ => {
31 p.error()
32 .message("expected identifier")
33 .emit();
34 }
35 };
27 }) 36 })
28} \ No newline at end of file 37} \ No newline at end of file