diff options
Diffstat (limited to 'src/parser_impl/input.rs')
-rw-r--r-- | src/parser_impl/input.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/parser_impl/input.rs b/src/parser_impl/input.rs index db76364b2..c0fe4d488 100644 --- a/src/parser_impl/input.rs +++ b/src/parser_impl/input.rs | |||
@@ -36,7 +36,22 @@ impl<'t> ParserInput<'t> { | |||
36 | self.tokens[idx].kind | 36 | self.tokens[idx].kind |
37 | } | 37 | } |
38 | 38 | ||
39 | #[allow(unused)] | 39 | pub fn len(&self, pos: InputPosition) -> TextUnit { |
40 | let idx = pos.0 as usize; | ||
41 | if !(idx < self.tokens.len()) { | ||
42 | return 0.into(); | ||
43 | } | ||
44 | self.tokens[idx].len | ||
45 | } | ||
46 | |||
47 | pub fn start(&self, pos: InputPosition) -> TextUnit { | ||
48 | let idx = pos.0 as usize; | ||
49 | if !(idx < self.tokens.len()) { | ||
50 | return 0.into(); | ||
51 | } | ||
52 | self.start_offsets[idx] | ||
53 | } | ||
54 | |||
40 | pub fn text(&self, pos: InputPosition) -> &'t str { | 55 | pub fn text(&self, pos: InputPosition) -> &'t str { |
41 | let idx = pos.0 as usize; | 56 | let idx = pos.0 as usize; |
42 | if !(idx < self.tokens.len()) { | 57 | if !(idx < self.tokens.len()) { |