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