right<O, V> method

void right<O, V>(
  1. Parser<O> parser, [
  2. dynamic action(
    1. V left,
    2. O operator,
    3. V right
    )?
])

Adds a right-associative operator parser. Evaluates the optional action with the parsed left term, operator, and right term.

Implementation

void right<O, V>(Parser<O> parser,
    [dynamic Function(V left, O operator, V right)? action]) {
  final callback =
      action ?? (left, operator, right) => [left, operator, right];
  _right.add(parser.map((operator) => ExpressionResult(operator, callback)));
}