aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2017-12-30 12:29:09 +0000
committerAleksey Kladov <[email protected]>2017-12-30 12:29:09 +0000
commit2d5217dbb76593a1dba1ff3db3ca0221c457e687 (patch)
tree9874ffed0e2cc39eee0c374738936954c1cee05c /src
parentddc637c16120fb352183698f635fc93a68580f7b (diff)
More readable lexer tests
Diffstat (limited to 'src')
-rw-r--r--src/lexer/ptr.rs3
-rw-r--r--src/text.rs4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/lexer/ptr.rs b/src/lexer/ptr.rs
index d441b826b..b380117e6 100644
--- a/src/lexer/ptr.rs
+++ b/src/lexer/ptr.rs
@@ -56,6 +56,7 @@ impl<'s> Ptr<'s> {
56 } 56 }
57 57
58 fn chars(&self) -> Chars { 58 fn chars(&self) -> Chars {
59 self.text[self.len.0 as usize ..].chars() 59 let len: u32 = self.len.into();
60 self.text[len as usize ..].chars()
60 } 61 }
61} 62}
diff --git a/src/text.rs b/src/text.rs
index 31e67b456..c3ef1ac8e 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -2,9 +2,7 @@ use std::fmt;
2use std::ops; 2use std::ops;
3 3
4#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 4#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub struct TextUnit( 5pub struct TextUnit(u32);
6 pub(crate) u32
7);
8 6
9impl TextUnit { 7impl TextUnit {
10 pub fn len_of_char(c: char) -> TextUnit { 8 pub fn len_of_char(c: char) -> TextUnit {