Skip to content

Commit

Permalink
Update json.rs
Browse files Browse the repository at this point in the history
Hey, I'm trying to get a better understanding of `nom` reading this example, and think the following makes sense:
- delete lines `70` and `71`, as `value` was already described (lines `64 to 66`), and this other description seemed incomplete
- change `true` to `false` in line `75`, as it makes more sense with the code that follows
  • Loading branch information
jufajardini authored and Geal committed Jan 23, 2021
1 parent b657387 commit ab01f04
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions examples/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ fn parse_str<'a, E: ParseError<&'a str>>(i: &'a str) -> IResult<&'a str, &'a str
///
/// `alt` is another combinator that tries multiple parsers one by one, until
/// one of them succeeds
///
/// `value` is a combinator that returns its value if the inner parser
fn boolean<'a, E: ParseError<&'a str>>(input: &'a str) -> IResult<&'a str, bool, E> {
// This is a parser that returns `true` if it sees the string "true", and
// an error otherwise
let parse_true = value(true, tag("true"));

// This is a parser that returns `true` if it sees the string "true", and
// This is a parser that returns `false` if it sees the string "false", and
// an error otherwise
let parse_false = value(false, tag("false"));

Expand Down

0 comments on commit ab01f04

Please sign in to comment.