Nom ignore result of sub-combinator in `tuple()`

I have a lot of nom code that looks like this:

tuple((tag("let"), alpha1, tag("="), digit1))(input)

However, the result of tuple includes the values parsed for the let and = tokens, which is useless to me. So I have to use .map(|(input, (_, name, _, value)| ...) to filter it out. Is there a combinator, or some other way, to ignore the result of those combinators?

Based on the type signature of tuple, I'm guessing the answer is "no", but I figured I might as well ask, especially if I'm going about it the wrong way.

I would write that with the preceded() and separated_pair() combinators.
preceded(tag("let"), separated_pair(alpha1, tag("="), digit1))(input)


Just seeing this now, thank you! Those seem like exactly what I want. I guess I just need to use higher-level combinators.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.