token method

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

Implementation

Parser token(Object source, [String? message]) {
  if (source is String) {
    return source
        .toParser(message: 'Expected ${message ?? source}')
        .token()
        .trim(ref0(spacer));
  } else if (source is Parser) {
    ArgumentError.checkNotNull(message, 'message');
    return source.flatten('Expected $message').token().trim(ref0(spacer));
  } else {
    throw ArgumentError('Unknown token type: $source.');
  }
}