mirror of https://github.com/rm-dr/daisy
Renamed functions for consistency
parent
c17a9f313b
commit
c0b0402a7d
|
@ -89,11 +89,11 @@ pub fn find_subs(
|
|||
|
||||
if target.is_none() {
|
||||
// Even if nothing changed, we need to update token location
|
||||
let l = t.get_mut_line_location();
|
||||
let l = t.get_mut_linelocation();
|
||||
*l = LineLocation{pos: l.pos - offset, len: l.len};
|
||||
} else {
|
||||
let target = target.unwrap();
|
||||
let l = t.get_mut_line_location();
|
||||
let l = t.get_mut_linelocation();
|
||||
r.push_back((*l, String::from(target)));
|
||||
|
||||
let old_len = l.len;
|
||||
|
|
|
@ -203,7 +203,7 @@ pub fn groupify(
|
|||
(LineLocation, DaisyError)
|
||||
> {
|
||||
|
||||
let last_linelocation: LineLocation = *g.back().unwrap().get_line_location();
|
||||
let last_linelocation: LineLocation = g.back().unwrap().get_linelocation();
|
||||
|
||||
// Vector of grouping levels
|
||||
let mut levels: Vec<(LineLocation, VecDeque<Token>)> = Vec::with_capacity(8);
|
||||
|
|
|
@ -66,7 +66,7 @@ fn treeify_binary(
|
|||
} {
|
||||
return Ok(false);
|
||||
} else {
|
||||
let tl = *this.get_line_location() + *l;
|
||||
let tl = this.get_linelocation() + *l;
|
||||
return Err((tl, DaisyError::Syntax)); // left argument isn't valid
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ fn treeify_binary(
|
|||
} {
|
||||
return Ok(false);
|
||||
} else {
|
||||
let tl = *this.get_line_location() + *l;
|
||||
let tl = this.get_linelocation() + *l;
|
||||
return Err((tl, DaisyError::Syntax)); // right argument isn't valid (two operators next to each other)
|
||||
}
|
||||
}
|
||||
|
@ -203,14 +203,14 @@ fn treeify_unary(
|
|||
} else {
|
||||
// Previous operator is invalid
|
||||
return Err((
|
||||
*this.get_line_location(),
|
||||
this.get_linelocation(),
|
||||
DaisyError::Syntax
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if let Token::Operator(l, _) = next {
|
||||
let tl = *this.get_line_location() + *l;
|
||||
let tl = this.get_linelocation() + *l;
|
||||
// Argument is invalid
|
||||
return Err((tl, DaisyError::Syntax));
|
||||
} else {
|
||||
|
|
|
@ -27,7 +27,7 @@ pub enum Token {
|
|||
|
||||
impl Token {
|
||||
#[inline(always)]
|
||||
pub fn get_line_location(&self) -> &LineLocation {
|
||||
pub fn get_linelocation(&self) -> LineLocation {
|
||||
match self {
|
||||
Token::Quantity(l, _)
|
||||
| Token::Word(l, _)
|
||||
|
@ -35,14 +35,14 @@ impl Token {
|
|||
| Token::GroupStart(l)
|
||||
| Token::GroupEnd(l)
|
||||
| Token::Group(l, _)
|
||||
=> l,
|
||||
=> l.clone(),
|
||||
|
||||
Token::Container(_) => panic!("Containers do not have a linelocation.")
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_mut_line_location(&mut self) -> &mut LineLocation {
|
||||
pub fn get_mut_linelocation(&mut self) -> &mut LineLocation {
|
||||
match self {
|
||||
Token::Quantity(l, _)
|
||||
| Token::Word(l, _)
|
||||
|
|
Loading…
Reference in New Issue