From 2141888782a74de4a655fee585c99163a3e75e5c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jan 2018 14:33:10 +0300 Subject: Rename raw_lookahead -> nth --- src/parser/event_parser/grammar/items.rs | 4 ++-- src/parser/event_parser/grammar/mod.rs | 6 +++--- src/parser/event_parser/grammar/paths.rs | 2 +- src/parser/event_parser/parser.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index 812e407d1..7fed5e83b 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs @@ -14,7 +14,7 @@ fn item(p: &mut Parser) { let item = p.start(); attributes::outer_attributes(p); visibility(p); - let la = p.raw_lookahead(1); + let la = p.nth(1); let item_kind = match p.current() { EXTERN_KW if la == CRATE_KW => { extern_crate_item(p); @@ -171,7 +171,7 @@ fn use_item(p: &mut Parser) { p.expect(SEMI); fn use_tree(p: &mut Parser) { - let la = p.raw_lookahead(1); + let la = p.nth(1); let m = p.start(); match (p.current(), la) { (STAR, _) => { diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index 79a4c10d3..931193b5f 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs @@ -20,7 +20,7 @@ fn visibility(p: &mut Parser) { let vis = p.start(); p.bump(); if p.at(L_PAREN) { - match p.raw_lookahead(1) { + match p.nth(1) { CRATE_KW | SELF_KW | SUPER_KW | IN_KW => { p.bump(); if p.bump() == IN_KW { @@ -87,13 +87,13 @@ impl Lookahead for SyntaxKind { impl Lookahead for [SyntaxKind; 2] { fn is_ahead(self, p: &Parser) -> bool { - p.current() == self[0] && p.raw_lookahead(1) == self[1] + p.current() == self[0] && p.nth(1) == self[1] } } impl Lookahead for [SyntaxKind; 3] { fn is_ahead(self, p: &Parser) -> bool { - p.current() == self[0] && p.raw_lookahead(1) == self[1] && p.raw_lookahead(2) == self[2] + p.current() == self[0] && p.nth(1) == self[1] && p.nth(2) == self[2] } } diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs index 4e028073a..6c8a89f6c 100644 --- a/src/parser/event_parser/grammar/paths.rs +++ b/src/parser/event_parser/grammar/paths.rs @@ -12,7 +12,7 @@ pub(crate) fn use_path(p: &mut Parser) { path_segment(p, true); let mut qual = path.complete(p, PATH); loop { - if p.at(COLONCOLON) && !items::is_use_tree_start(p.raw_lookahead(1)) { + if p.at(COLONCOLON) && !items::is_use_tree_start(p.nth(1)) { let path = qual.precede(p); p.bump(); path_segment(p, false); diff --git a/src/parser/event_parser/parser.rs b/src/parser/event_parser/parser.rs index 2507af6bf..a15d0b633 100644 --- a/src/parser/event_parser/parser.rs +++ b/src/parser/event_parser/parser.rs @@ -164,12 +164,12 @@ impl<'t> Parser<'t> { kind } - pub(crate) fn raw_lookahead(&self, n: usize) -> SyntaxKind { + pub(crate) fn nth(&self, n: usize) -> SyntaxKind { self.tokens.get(self.pos + n).map(|t| t.kind).unwrap_or(EOF) } pub(crate) fn current(&self) -> SyntaxKind { - self.raw_lookahead(0) + self.nth(0) } fn event(&mut self, event: Event) { -- cgit v1.2.3