From 29b2e0adcc35834dda2884222624bfcc268a3eff Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 13 Jan 2018 11:55:03 +0300 Subject: G: allow self & super in paths --- src/parser/event_parser/grammar/paths.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/parser') 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 @@ use super::*; pub(crate) fn use_path(p: &mut Parser) { - if !AnyOf(&[IDENT, COLONCOLON]).is_ahead(p) { + if !AnyOf(&[IDENT, SELF_KW, SUPER_KW, COLONCOLON]).is_ahead(p) { return; } let mut prev = p.mark(); @@ -23,6 +23,15 @@ fn path_segment(p: &mut Parser, first: bool) { if first { p.eat(COLONCOLON); } - p.expect(IDENT); + match p.current() { + IDENT | SELF_KW | SUPER_KW => { + p.bump(); + }, + _ => { + p.error() + .message("expected identifier") + .emit(); + } + }; }) } \ No newline at end of file -- cgit v1.2.3