Skip to content

Commit

Permalink
Merge pull request #638 from epage/w7
Browse files Browse the repository at this point in the history
chore: Upgrade to Winnow 0.7
  • Loading branch information
epage authored Jan 30, 2025
2 parents b57cf19 + 2bb4a35 commit 00412f1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
17 changes: 13 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ json5_rs = { version = "0.4", optional = true, package = "json5" }
indexmap = { version = "2.2", features = ["serde"], optional = true }
convert_case = { version = "0.6", optional = true }
pathdiff = "0.2"
winnow = "0.6.20"
winnow = "0.7.0"

[dev-dependencies]
serde_derive = "1.0"
Expand Down
8 changes: 4 additions & 4 deletions src/path/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ pub(crate) fn from_str(input: &str) -> Result<Expression, ParseError<&str, Conte
path.parse(input)
}

fn path(i: &mut &str) -> PResult<Expression> {
fn path(i: &mut &str) -> ModalResult<Expression> {
let root = ident.parse_next(i)?;
let postfix = repeat(0.., postfix).parse_next(i)?;
let expr = Expression { root, postfix };
Ok(expr)
}

fn postfix(i: &mut &str) -> PResult<Postfix> {
fn postfix(i: &mut &str) -> ModalResult<Postfix> {
dispatch! {any;
'[' => cut_err(
seq!(
Expand All @@ -51,7 +51,7 @@ fn postfix(i: &mut &str) -> PResult<Postfix> {
.parse_next(i)
}

fn ident(i: &mut &str) -> PResult<String> {
fn ident(i: &mut &str) -> ModalResult<String> {
take_while(1.., ('a'..='z', 'A'..='Z', '0'..='9', '_', '-'))
.map(ToOwned::to_owned)
.context(StrContext::Label("identifier"))
Expand All @@ -63,7 +63,7 @@ fn ident(i: &mut &str) -> PResult<String> {
.parse_next(i)
}

fn integer(i: &mut &str) -> PResult<isize> {
fn integer(i: &mut &str) -> ModalResult<isize> {
seq!(
_: space0,
(opt('-'), digit1).take().try_map(FromStr::from_str),
Expand Down

0 comments on commit 00412f1

Please sign in to comment.