mirror of
https://github.com/loot/loot-condition-interpreter.git
synced 2026-07-27 14:16:09 -07:00
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:
co-authored by
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
parent
2d05577fab
commit
ebae951eae
+1
-1
@@ -8,7 +8,7 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
crc32fast = "1.2.0"
|
crc32fast = "1.2.0"
|
||||||
esplugin = "3.0.0"
|
esplugin = "3.0.0"
|
||||||
nom = "5.0.0"
|
nom = "6.0.0"
|
||||||
pelite = "0.9.0"
|
pelite = "0.9.0"
|
||||||
regex = "1.0.5"
|
regex = "1.0.5"
|
||||||
unicase = "2.2.0"
|
unicase = "2.2.0"
|
||||||
|
|||||||
@@ -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> {
|
impl<I: fmt::Debug + fmt::Display> fmt::Display for ParsingError<I> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ fn parse_crc(input: &str) -> ParsingResult<u32> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn parse_checksum_args(input: &str) -> ParsingResult<(PathBuf, u32)> {
|
fn parse_checksum_args(input: &str) -> ParsingResult<(PathBuf, u32)> {
|
||||||
let parser = tuple((
|
let mut parser = tuple((
|
||||||
map_err(parse_path),
|
map_err(parse_path),
|
||||||
map_err(whitespace(tag(","))),
|
map_err(whitespace(tag(","))),
|
||||||
map_parser(hex_digit1, parse_crc),
|
map_parser(hex_digit1, parse_crc),
|
||||||
|
|||||||
+7
-7
@@ -14,7 +14,7 @@ use nom::branch::alt;
|
|||||||
use nom::bytes::complete::tag;
|
use nom::bytes::complete::tag;
|
||||||
use nom::character::complete::space0;
|
use nom::character::complete::space0;
|
||||||
use nom::combinator::map;
|
use nom::combinator::map;
|
||||||
use nom::multi::separated_list;
|
use nom::multi::separated_list0;
|
||||||
use nom::sequence::{delimited, preceded};
|
use nom::sequence::{delimited, preceded};
|
||||||
use nom::IResult;
|
use nom::IResult;
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ impl str::FromStr for Expression {
|
|||||||
|
|
||||||
fn parse_expression(input: &str) -> ParsingResult<Expression> {
|
fn parse_expression(input: &str) -> ParsingResult<Expression> {
|
||||||
map(
|
map(
|
||||||
separated_list(map_err(whitespace(tag("or"))), CompoundCondition::parse),
|
separated_list0(map_err(whitespace(tag("or"))), CompoundCondition::parse),
|
||||||
Expression,
|
Expression,
|
||||||
)(input)
|
)(input)
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ impl CompoundCondition {
|
|||||||
|
|
||||||
fn parse(input: &str) -> ParsingResult<CompoundCondition> {
|
fn parse(input: &str) -> ParsingResult<CompoundCondition> {
|
||||||
map(
|
map(
|
||||||
separated_list(map_err(whitespace(tag("and"))), Condition::parse),
|
separated_list0(map_err(whitespace(tag("and"))), Condition::parse),
|
||||||
CompoundCondition,
|
CompoundCondition,
|
||||||
)(input)
|
)(input)
|
||||||
}
|
}
|
||||||
@@ -263,14 +263,14 @@ impl fmt::Display for Condition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn map_err<'a, O>(
|
fn map_err<'a, O>(
|
||||||
parser: impl Fn(&'a str) -> IResult<&'a str, O, (&'a str, nom::error::ErrorKind)>,
|
mut parser: impl FnMut(&'a str) -> IResult<&'a str, O, nom::error::Error<&'a str>>,
|
||||||
) -> impl Fn(&'a str) -> ParsingResult<'a, O> {
|
) -> impl FnMut(&'a str) -> ParsingResult<'a, O> {
|
||||||
move |i| parser(i).map_err(nom::Err::convert)
|
move |i| parser(i).map_err(nom::Err::convert)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn whitespace<'a, O>(
|
fn whitespace<'a, O>(
|
||||||
parser: impl Fn(&'a str) -> IResult<&'a str, 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)
|
delimited(space0, parser, space0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ mod tests {
|
|||||||
let error = Expression::from_str("file(\"Carg").unwrap_err();
|
let error = Expression::from_str("file(\"Carg").unwrap_err();
|
||||||
|
|
||||||
assert_eq!(
|
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()
|
error.to_string()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user