Skip to content

Commit 2141888

Browse files
committed
Rename raw_lookahead -> nth
1 parent 60725de commit 2141888

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/parser/event_parser/grammar/items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn item(p: &mut Parser) {
1414
let item = p.start();
1515
attributes::outer_attributes(p);
1616
visibility(p);
17-
let la = p.raw_lookahead(1);
17+
let la = p.nth(1);
1818
let item_kind = match p.current() {
1919
EXTERN_KW if la == CRATE_KW => {
2020
extern_crate_item(p);
@@ -171,7 +171,7 @@ fn use_item(p: &mut Parser) {
171171
p.expect(SEMI);
172172

173173
fn use_tree(p: &mut Parser) {
174-
let la = p.raw_lookahead(1);
174+
let la = p.nth(1);
175175
let m = p.start();
176176
match (p.current(), la) {
177177
(STAR, _) => {

src/parser/event_parser/grammar/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn visibility(p: &mut Parser) {
2020
let vis = p.start();
2121
p.bump();
2222
if p.at(L_PAREN) {
23-
match p.raw_lookahead(1) {
23+
match p.nth(1) {
2424
CRATE_KW | SELF_KW | SUPER_KW | IN_KW => {
2525
p.bump();
2626
if p.bump() == IN_KW {
@@ -87,13 +87,13 @@ impl Lookahead for SyntaxKind {
8787

8888
impl Lookahead for [SyntaxKind; 2] {
8989
fn is_ahead(self, p: &Parser) -> bool {
90-
p.current() == self[0] && p.raw_lookahead(1) == self[1]
90+
p.current() == self[0] && p.nth(1) == self[1]
9191
}
9292
}
9393

9494
impl Lookahead for [SyntaxKind; 3] {
9595
fn is_ahead(self, p: &Parser) -> bool {
96-
p.current() == self[0] && p.raw_lookahead(1) == self[1] && p.raw_lookahead(2) == self[2]
96+
p.current() == self[0] && p.nth(1) == self[1] && p.nth(2) == self[2]
9797
}
9898
}
9999

src/parser/event_parser/grammar/paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) fn use_path(p: &mut Parser) {
1212
path_segment(p, true);
1313
let mut qual = path.complete(p, PATH);
1414
loop {
15-
if p.at(COLONCOLON) && !items::is_use_tree_start(p.raw_lookahead(1)) {
15+
if p.at(COLONCOLON) && !items::is_use_tree_start(p.nth(1)) {
1616
let path = qual.precede(p);
1717
p.bump();
1818
path_segment(p, false);

src/parser/event_parser/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ impl<'t> Parser<'t> {
164164
kind
165165
}
166166

167-
pub(crate) fn raw_lookahead(&self, n: usize) -> SyntaxKind {
167+
pub(crate) fn nth(&self, n: usize) -> SyntaxKind {
168168
self.tokens.get(self.pos + n).map(|t| t.kind).unwrap_or(EOF)
169169
}
170170

171171
pub(crate) fn current(&self) -> SyntaxKind {
172-
self.raw_lookahead(0)
172+
self.nth(0)
173173
}
174174

175175
fn event(&mut self, event: Event) {

0 commit comments

Comments
 (0)