cast<S> method

  1. @useResult
Parser<S> cast<S>()

Returns a parser that casts itself to Parser<R>.

For example, the parser digit().map(int.parse).cast<num>() returns the integer value of the parsed digit as a num.

Implementation

@useResult
Parser<S> cast<S>() => CastParser<R, S>(this);