Skip to content

Recognize doesn't work with tuple #1887

Description

@RunBolt

Environment

nom = "8.0.0"

Problem

When using recognize((satisfy(|c| c.is_uppercase()), alpha0)) parser, this produces only the first character of Hello.

        #[test]
        fn test_name() {
            let testing = || -> IResult<_, _> {
                recognize((satisfy(|c: char| c.is_uppercase()), alpha0)).parse("Hello")
            };
            let (rest, name) = testing().unwrap();
            println!("Name: {name:?}");
            println!("Rest: {rest:?}");
        }

This prints:

Name: "H"
Rest: ""

When I change it to use just the inner tuple: (satisfy(|c: char| c.is_uppercase()), alpha0)

Name: ('H', "ello")
Rest: ""

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions