token method

Parser token(
  1. Object parser, [
  2. String? message
])

Implementation

Parser token(Object parser, [String? message]) {
  if (parser is Parser) {
    return parser.flatten(message).trim(ref0(space));
  } else if (parser is String) {
    return parser
        .toParser(message: message ?? '$parser expected')
        .trim(ref0(space));
  } else {
    throw ArgumentError.value(parser, 'parser', 'Invalid parser type');
  }
}