From ab01f04375730bef7377cbbe45bc21a727504b88 Mon Sep 17 00:00:00 2001 From: jufajardini Date: Thu, 7 Jan 2021 14:20:20 +0000 Subject: [PATCH] Update json.rs 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 --- examples/json.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/json.rs b/examples/json.rs index ba287ff48..09ff21a97 100644 --- a/examples/json.rs +++ b/examples/json.rs @@ -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"));