diff options
author | Aleksey Kladov <[email protected]> | 2018-08-05 14:09:25 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-05 14:09:25 +0100 |
commit | 1e1e2e83c462b7efacaa0e33812beed72a88ab5f (patch) | |
tree | 134caad399dc6a3cc4bfccf49d525e8db646a657 /src/parser_impl/input.rs | |
parent | 5691da4c84655e0d966ac11406fa7a90bdd02643 (diff) |
compound ops
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()) { |