Skip to content

Commit

Permalink
update to nom 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Feb 17, 2018
1 parent 1e16a3b commit e3f25ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ hjson = ["serde-hjson"]
[dependencies]
lazy_static = "1.0"
serde = "^1.0.8"
nom = "^3.2.1"
nom = "4.0.0-beta1"

toml = { version = "^0.4.1", optional = true }
serde_json = { version = "^1.0.2", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions src/path/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ fn postfix(expr: Expression) -> Box<Fn(&[u8]) -> IResult<&[u8], Expression>> {

pub fn from_str(input: &str) -> Result<Expression, ErrorKind> {
match ident(input.as_bytes()) {
IResult::Done(mut rem, mut expr) => {
Ok((mut rem, mut expr)) => {
while !rem.is_empty() {
match postfix(expr)(rem) {
IResult::Done(rem_, expr_) => {
Ok((rem_, expr_)) => {
rem = rem_;
expr = expr_;
}

// Forward Incomplete and Error
result => {
return result.to_result().map_err(|e| e.into_error_kind());
return result.map(|(_,o)| o).map_err(|e| e.into_error_kind());
}
}
}
Expand All @@ -74,7 +74,7 @@ pub fn from_str(input: &str) -> Result<Expression, ErrorKind> {
}

// Forward Incomplete and Error
result => result.to_result().map_err(|e| e.into_error_kind()),
result => result.map(|(_,o)| o).map_err(|e| e.into_error_kind()),
}
}

Expand Down

0 comments on commit e3f25ce

Please sign in to comment.