chore: simplify expressions
parent
7bd2a7bfdb
commit
7111ea0eed
|
@ -260,10 +260,7 @@ pub fn parse_conditional_expression(input: &str) -> Result<ConditionalExpression
|
||||||
let mut i: &str = input;
|
let mut i: &str = input;
|
||||||
|
|
||||||
// Consume whitespace from the input
|
// Consume whitespace from the input
|
||||||
i = match ws0(i) {
|
(i, _) = ws0(i).expect("ws0 is infallible");
|
||||||
Ok((i1, _)) => i1,
|
|
||||||
_ => unreachable!("ws0 is infallible"),
|
|
||||||
};
|
|
||||||
|
|
||||||
if i.is_empty() {
|
if i.is_empty() {
|
||||||
return Err(ParseError {
|
return Err(ParseError {
|
||||||
|
@ -293,10 +290,7 @@ pub fn parse_conditional_expression(input: &str) -> Result<ConditionalExpression
|
||||||
};
|
};
|
||||||
|
|
||||||
// Consume remaining whitespace from the input
|
// Consume remaining whitespace from the input
|
||||||
i = match ws0(i) {
|
(i, _) = ws0(i).expect("ws0 is infallible");
|
||||||
Ok((i1, _)) => i1,
|
|
||||||
_ => unreachable!("ws0 is infallible"),
|
|
||||||
};
|
|
||||||
|
|
||||||
if !i.is_empty() {
|
if !i.is_empty() {
|
||||||
return Err(ParseError {
|
return Err(ParseError {
|
||||||
|
|
|
@ -69,10 +69,7 @@ pub fn parse_statements(input: &str) -> ParseResult {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// Consume whitespace from the input
|
// Consume whitespace from the input
|
||||||
i = match ws0(i) {
|
(i, _) = ws0(i).expect("ws0 is infallible");
|
||||||
Ok((i1, _)) => i1,
|
|
||||||
_ => unreachable!("ws0 is infallible"),
|
|
||||||
};
|
|
||||||
|
|
||||||
if eof::<_, nom::error::Error<_>>(i).is_ok() {
|
if eof::<_, nom::error::Error<_>>(i).is_ok() {
|
||||||
return Ok(res);
|
return Ok(res);
|
||||||
|
|
Loading…
Reference in New Issue