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