diff options
Diffstat (limited to 'crates/ra_syntax/src/parser_impl.rs')
-rw-r--r-- | crates/ra_syntax/src/parser_impl.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/parser_impl.rs b/crates/ra_syntax/src/parser_impl.rs index d4032a6d9..ce321aecb 100644 --- a/crates/ra_syntax/src/parser_impl.rs +++ b/crates/ra_syntax/src/parser_impl.rs | |||
@@ -64,7 +64,6 @@ pub(crate) fn parse_with<S: Sink>( | |||
64 | /// the public API of the `Parser`. | 64 | /// the public API of the `Parser`. |
65 | pub(crate) struct ParserImpl<'t> { | 65 | pub(crate) struct ParserImpl<'t> { |
66 | inp: &'t ParserInput<'t>, | 66 | inp: &'t ParserInput<'t>, |
67 | |||
68 | pos: InputPosition, | 67 | pos: InputPosition, |
69 | events: Vec<Event>, | 68 | events: Vec<Event>, |
70 | steps: Cell<u32>, | 69 | steps: Cell<u32>, |
@@ -74,7 +73,6 @@ impl<'t> ParserImpl<'t> { | |||
74 | pub(crate) fn new(inp: &'t ParserInput<'t>) -> ParserImpl<'t> { | 73 | pub(crate) fn new(inp: &'t ParserInput<'t>) -> ParserImpl<'t> { |
75 | ParserImpl { | 74 | ParserImpl { |
76 | inp, | 75 | inp, |
77 | |||
78 | pos: InputPosition::new(), | 76 | pos: InputPosition::new(), |
79 | events: Vec::new(), | 77 | events: Vec::new(), |
80 | steps: Cell::new(0), | 78 | steps: Cell::new(0), |
@@ -89,7 +87,9 @@ impl<'t> ParserImpl<'t> { | |||
89 | pub(super) fn next2(&self) -> Option<(SyntaxKind, SyntaxKind)> { | 87 | pub(super) fn next2(&self) -> Option<(SyntaxKind, SyntaxKind)> { |
90 | let c1 = self.inp.kind(self.pos); | 88 | let c1 = self.inp.kind(self.pos); |
91 | let c2 = self.inp.kind(self.pos + 1); | 89 | let c2 = self.inp.kind(self.pos + 1); |
92 | if self.inp.start(self.pos + 1) == self.inp.start(self.pos) + self.inp.len(self.pos) { | 90 | if self.inp.token_start_at(self.pos + 1) |
91 | == self.inp.token_start_at(self.pos) + self.inp.len(self.pos) | ||
92 | { | ||
93 | Some((c1, c2)) | 93 | Some((c1, c2)) |
94 | } else { | 94 | } else { |
95 | None | 95 | None |
@@ -100,9 +100,10 @@ impl<'t> ParserImpl<'t> { | |||
100 | let c1 = self.inp.kind(self.pos); | 100 | let c1 = self.inp.kind(self.pos); |
101 | let c2 = self.inp.kind(self.pos + 1); | 101 | let c2 = self.inp.kind(self.pos + 1); |
102 | let c3 = self.inp.kind(self.pos + 2); | 102 | let c3 = self.inp.kind(self.pos + 2); |
103 | if self.inp.start(self.pos + 1) == self.inp.start(self.pos) + self.inp.len(self.pos) | 103 | if self.inp.token_start_at(self.pos + 1) |
104 | && self.inp.start(self.pos + 2) | 104 | == self.inp.token_start_at(self.pos) + self.inp.len(self.pos) |
105 | == self.inp.start(self.pos + 1) + self.inp.len(self.pos + 1) | 105 | && self.inp.token_start_at(self.pos + 2) |
106 | == self.inp.token_start_at(self.pos + 1) + self.inp.len(self.pos + 1) | ||
106 | { | 107 | { |
107 | Some((c1, c2, c3)) | 108 | Some((c1, c2, c3)) |
108 | } else { | 109 | } else { |