Update nom requirement from 5.0.0 to 6.0.0 (#6)

Updates the requirements on [nom](https://github.com/Geal/nom) to permit the latest version.
- [Release notes](https://github.com/Geal/nom/releases)
- [Changelog](https://github.com/Geal/nom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Geal/nom/compare/5.0.0...6.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2020-11-02 18:51:39 +00:00
committed by GitHub
co-authored by dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
parent 2d05577fab
commit ebae951eae
4 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
crc32fast = "1.2.0"
esplugin = "3.0.0"
nom = "5.0.0"
nom = "6.0.0"
pelite = "0.9.0"
regex = "1.0.5"
unicase = "2.2.0"
+7
View File
@@ -85,6 +85,13 @@ impl<I: fmt::Debug + fmt::Display> From<(I, ErrorKind)> for ParsingError<I> {
}
}
impl<I: fmt::Debug + fmt::Display> From<nom::error::Error<I>> for ParsingError<I> {
fn from(error: nom::error::Error<I>) -> Self {
use nom::error::ParseError;
ParsingError::from_error_kind(error.input, error.code)
}
}
impl<I: fmt::Debug + fmt::Display> fmt::Display for ParsingError<I> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
+1 -1
View File
@@ -93,7 +93,7 @@ fn parse_crc(input: &str) -> ParsingResult<u32> {
}
fn parse_checksum_args(input: &str) -> ParsingResult<(PathBuf, u32)> {
let parser = tuple((
let mut parser = tuple((
map_err(parse_path),
map_err(whitespace(tag(","))),
map_parser(hex_digit1, parse_crc),
+7 -7
View File
@@ -14,7 +14,7 @@ use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::space0;
use nom::combinator::map;
use nom::multi::separated_list;
use nom::multi::separated_list0;
use nom::sequence::{delimited, preceded};
use nom::IResult;
@@ -175,7 +175,7 @@ impl str::FromStr for Expression {
fn parse_expression(input: &str) -> ParsingResult<Expression> {
map(
separated_list(map_err(whitespace(tag("or"))), CompoundCondition::parse),
separated_list0(map_err(whitespace(tag("or"))), CompoundCondition::parse),
Expression,
)(input)
}
@@ -203,7 +203,7 @@ impl CompoundCondition {
fn parse(input: &str) -> ParsingResult<CompoundCondition> {
map(
separated_list(map_err(whitespace(tag("and"))), Condition::parse),
separated_list0(map_err(whitespace(tag("and"))), Condition::parse),
CompoundCondition,
)(input)
}
@@ -263,14 +263,14 @@ impl fmt::Display for Condition {
}
fn map_err<'a, O>(
parser: impl Fn(&'a str) -> IResult<&'a str, O, (&'a str, nom::error::ErrorKind)>,
) -> impl Fn(&'a str) -> ParsingResult<'a, O> {
mut parser: impl FnMut(&'a str) -> IResult<&'a str, O, nom::error::Error<&'a str>>,
) -> impl FnMut(&'a str) -> ParsingResult<'a, O> {
move |i| parser(i).map_err(nom::Err::convert)
}
fn whitespace<'a, O>(
parser: impl Fn(&'a str) -> IResult<&'a str, O>,
) -> impl Fn(&'a str) -> IResult<&'a str, O> {
) -> impl FnMut(&'a str) -> IResult<&'a str, O> {
delimited(space0, parser, space0)
}
@@ -454,7 +454,7 @@ mod tests {
let error = Expression::from_str("file(\"Carg").unwrap_err();
assert_eq!(
"An error was encountered while parsing the expression \"file(\\\"Carg\": Error in parser: Separated list",
"The parser did not consume the following input: \"file(\"Carg\"",
error.to_string()
);
}