Minor tweaks

pull/2/head
Mark 2023-08-03 13:57:39 -07:00
parent f130bed7aa
commit 07edc4f047
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 9 additions and 1 deletions

View File

@ -15,12 +15,20 @@ impl LineLocation {
pub fn zero(&self) -> bool {
return self.pos == 0 && self.len == 0
}
pub fn new_zero() -> LineLocation {
return LineLocation { pos: 0, len: 0}
}
pub fn cut_string<'a>(&self, s: &'a String) -> &'a str {
&s[self.pos..self.pos+self.len]
}
}
impl PartialEq for LineLocation {
fn eq(&self, other: &Self) -> bool {
self.pos == other.pos &&
self.len ==other.len
self.len == other.len
}
}