Clean-up
This commit is contained in:
parent
a6edd2e9cc
commit
31805fa9d8
@ -446,116 +446,6 @@ fn quantified_formula(input: &str, quantifier: Quantifier, level: usize)
|
||||
Ok(formula)
|
||||
}
|
||||
|
||||
/*struct ComparisonOperatorIterator<'i>
|
||||
{
|
||||
original_input: &'i str,
|
||||
input: &'i str,
|
||||
}
|
||||
|
||||
impl<'i> ComparisonOperatorIterator<'i>
|
||||
{
|
||||
pub fn new(input: &'i str) -> Self
|
||||
{
|
||||
Self
|
||||
{
|
||||
original_input: input,
|
||||
input,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: refactor
|
||||
impl<'i> std::iter::Iterator for ComparisonOperatorIterator<'i>
|
||||
{
|
||||
type Item = Result<(&'i str, &'i str, crate::ComparisonOperator), crate::parse::Error>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item>
|
||||
{
|
||||
loop
|
||||
{
|
||||
self.input = self.input.trim_start();
|
||||
|
||||
let first_character = match self.input.chars().next()
|
||||
{
|
||||
None => return None,
|
||||
Some(first_character) => first_character,
|
||||
};
|
||||
|
||||
if self.input.starts_with(")")
|
||||
{
|
||||
return Some(Err(crate::parse::Error::new_unmatched_parenthesis(
|
||||
crate::parse::error::Location::new(0, Some(1)))));
|
||||
}
|
||||
|
||||
match parenthesized_expression(self.input)
|
||||
{
|
||||
Ok(Some((_, remaining_input))) =>
|
||||
{
|
||||
self.input = remaining_input;
|
||||
continue;
|
||||
},
|
||||
Ok(None) => (),
|
||||
Err(error) => return Some(Err(error)),
|
||||
}
|
||||
|
||||
match number(self.input)
|
||||
{
|
||||
Ok(Some((_, remaining_input))) =>
|
||||
{
|
||||
self.input = remaining_input;
|
||||
continue;
|
||||
}
|
||||
Ok(None) => (),
|
||||
Err(error) => return Some(Err(error)),
|
||||
}
|
||||
|
||||
let index_left = self.input.as_ptr() as usize - self.original_input.as_ptr() as usize;
|
||||
let input_left = self.original_input.split_at(index_left).0.trim_end();
|
||||
|
||||
if let Some((symbol, remaining_input)) = symbol(self.input)
|
||||
{
|
||||
self.input = remaining_input;
|
||||
|
||||
match symbol
|
||||
{
|
||||
Symbol::Greater =>
|
||||
return Some(Ok((input_left, remaining_input,
|
||||
crate::ComparisonOperator::Greater))),
|
||||
Symbol::GreaterOrEqual =>
|
||||
return Some(Ok((input_left, remaining_input,
|
||||
crate::ComparisonOperator::GreaterOrEqual))),
|
||||
Symbol::Less =>
|
||||
return Some(Ok((input_left, remaining_input,
|
||||
crate::ComparisonOperator::Less))),
|
||||
Symbol::LessOrEqual =>
|
||||
return Some(Ok((input_left, remaining_input,
|
||||
crate::ComparisonOperator::LessOrEqual))),
|
||||
Symbol::Equal =>
|
||||
return Some(Ok((input_left, remaining_input,
|
||||
crate::ComparisonOperator::Equal))),
|
||||
Symbol::NotEqual =>
|
||||
return Some(Ok((input_left, remaining_input,
|
||||
crate::ComparisonOperator::NotEqual))),
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
|
||||
match identifier(self.input)
|
||||
{
|
||||
Some((_, remaining_input)) =>
|
||||
{
|
||||
self.input = remaining_input;
|
||||
continue;
|
||||
}
|
||||
None => (),
|
||||
}
|
||||
|
||||
return Some(Err(crate::parse::Error::new_character_not_allowed(first_character,
|
||||
crate::parse::error::Location::new(0, Some(0)))));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user