postfix<O, V> method

void postfix<O, V>(
  1. Parser<O> parser, [
  2. dynamic action(
    1. V value,
    2. O operator
    )?
])

Adds a postfix operator parser. Evaluates the optional action with the parsed value and operator.

Implementation

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