Update nom to 6.0.0-alpha1

This commit is contained in:
Patrick Lühne 2020-04-17 18:22:50 +02:00
parent 0d5971cad7
commit 2b3add562f
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
3 changed files with 13 additions and 15 deletions

View File

@ -13,7 +13,7 @@ license = "MIT"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
nom = {version = "5.1", optional = true} nom = {version = ">=6.0.0-alpha1, <6.1", optional = true}
[features] [features]
default = ["parse"] default = ["parse"]

View File

@ -5,7 +5,7 @@ use nom::
bytes::complete::tag, bytes::complete::tag,
character::complete::multispace0, character::complete::multispace0,
combinator::{cut, map, map_res}, combinator::{cut, map, map_res},
multi::{many1, separated_list}, multi::{many1, separated_list1},
sequence::{delimited, pair, preceded, terminated, tuple}, sequence::{delimited, pair, preceded, terminated, tuple},
}; };
@ -61,7 +61,7 @@ where
{ {
map_res map_res
( (
separated_list separated_list1
( (
delimited delimited
( (
@ -83,6 +83,7 @@ where
} }
else else
{ {
// TODO: return more appropriate error type
Err(nom::error::make_error(i, nom::error::ErrorKind::Many1)) Err(nom::error::make_error(i, nom::error::ErrorKind::Many1))
} }
} }
@ -96,7 +97,7 @@ where
{ {
map_res map_res
( (
separated_list separated_list1
( (
delimited delimited
( (
@ -118,6 +119,7 @@ where
} }
else else
{ {
// TODO: return more appropriate error type
Err(nom::error::make_error(i, nom::error::ErrorKind::Many1)) Err(nom::error::make_error(i, nom::error::ErrorKind::Many1))
} }
} }
@ -193,7 +195,7 @@ where
{ {
map_res map_res
( (
separated_list separated_list1
( (
delimited delimited
( (
@ -211,6 +213,7 @@ where
} }
else else
{ {
// TODO: return more appropriate error type
Err(nom::error::make_error(i, nom::error::ErrorKind::Many1)) Err(nom::error::make_error(i, nom::error::ErrorKind::Many1))
} }
} }
@ -240,7 +243,7 @@ where
delimited delimited
( (
multispace0, multispace0,
separated_list separated_list1
( (
delimited delimited
( (
@ -259,15 +262,10 @@ where
std::rc::Rc::new, std::rc::Rc::new,
)(i)?; )(i)?;
if variable_declarations.is_empty() let bound_variable_declarations = crate::VariableDeclarationStackLayer::bound(v,
{
return Err(nom::Err::Failure((i, nom::error::ErrorKind::Many1)));
}
let v2 = crate::VariableDeclarationStackLayer::bound(v,
std::rc::Rc::clone(&variable_declarations)); std::rc::Rc::clone(&variable_declarations));
let (i, argument) = formula_precedence_0(i, d, &v2)?; let (i, argument) = formula_precedence_0(i, d, &bound_variable_declarations)?;
Ok((i, crate::QuantifiedFormula::new(variable_declarations, Box::new(argument)))) Ok((i, crate::QuantifiedFormula::new(variable_declarations, Box::new(argument))))
} }

View File

@ -5,7 +5,7 @@ use nom::
bytes::complete::tag, bytes::complete::tag,
character::complete::multispace0, character::complete::multispace0,
combinator::{map, opt}, combinator::{map, opt},
multi::{many1, separated_list}, multi::{many1, separated_list0},
sequence::{delimited, pair, preceded, terminated}, sequence::{delimited, pair, preceded, terminated},
}; };
@ -82,7 +82,7 @@ where
tag("("), tag("("),
multispace0, multispace0,
), ),
separated_list separated_list0
( (
delimited delimited
( (