map<R> method
Returns a parser that evaluates a callback
as the production action
on success of the receiver.
By default we assume the callback
to be side-effect free. Unless
hasSideEffects
is set to true
, the execution might be skipped if there
are no direct dependencies.
For example, the parser digit().map((char) => int.parse(char))
returns
the number 1
for the input string '1'
. If the delegate fails, the
production action is not executed and the failure is passed on.
Implementation
Parser<R> map<R>(Callback<T, R> callback, {bool hasSideEffects = false}) =>
MapParser<T, R>(this, callback, hasSideEffects);