src/Parsley/ParserQuery.cs
/// <summary>
/// Extend a parser such that, after executing, the remaining input is processed by the next parser in the chain.
/// </summary>
/// <remarks>
/// In monadic terms, this is the 'Bind' function.
/// </remarks>
Extend a parser such that, after executing, the remaining input is processed by the next parser in the chain.
Extend a parser such that after executing the remaining input is processed by the next parser in the chain .
private static Parser<U> Bind<T, U>(this Parser<T> parser, Func<T, Parser<U>> constructNextParser)
        {
            return new LambdaParser<U>(tokens =>
            {
                var reply = parser.Parse(tokens);
                if (reply.Success)
                    return constructNextParser(reply.Value).Parse(reply.UnparsedTokens);
                return new Error<U>(reply.UnparsedTokens, reply.ErrorMessages);
            });
        }
private static Parser < U > Bind < T , U > ( this Parser < T > parser , Func < T , Parser < U > > constructNextParser ) { return new LambdaParser < U > ( tokens => { var reply = parser . Parse ( tokens ) ; if ( reply . Success ) return constructNextParser ( reply . Value ) . Parse ( reply . UnparsedTokens ) ; return new Error < U > ( reply . UnparsedTokens , reply . ErrorMessages ) ; } ) ; }
Extend a parser such that, after executing, the remaining input is processed by the next parser in the chain.
Extend a parser such that after executing the remaining input is processed by the next parser in the chain .
Parser<T>
this
constructNextParser
Func<T, Parser<U>>
remarks
In monadic terms, this is the 'Bind' function.
In monadic terms this is the ' Bind ' function .