wrapper<O, V> method
void
wrapper<O, V>(])
Defines a new wrapper using left
and right
parsers, that are typically
used for parenthesis. Evaluates the optional action
with the parsed
left
delimiter, the value
and right
delimiter.
Implementation
void wrapper<O, V>(Parser<O> left, Parser<O> right,
[dynamic Function(O left, V value, O right)? action]) {
final callback = action ?? (left, value, right) => [left, value, right];
_wrappers.add([left, _loopback, right]
.toSequenceParser()
.map((value) => callback(value[0], value[1], value[2])));
}