Exemplo n.º 1
0
 /// <summary>
 /// Parse a sequence of similar operands connected by left-associative operators.
 /// </summary>
 /// <typeparam name="T">The type being parsed.</typeparam>
 /// <typeparam name="TOperator">The type of the operator.</typeparam>
 /// <param name="operator">A parser matching operators.</param>
 /// <param name="operand">A parser matching operands.</param>
 /// <param name="apply">A function combining an operator and two operands into the result.</param>
 /// <returns>The result of calling <paramref name="apply"/> successively on pairs of operands.</returns>
 /// <seealso cref="Combinators.Chain{TResult,TOperator,TOperand}"/>
 public static TextParser <T> Chain <T, TOperator>(
     TextParser <TOperator> @operator,
     TextParser <T> operand,
     Func <TOperator, T, T, T> apply)
 {
     return(operand.Chain(@operator, operand, apply));
 }