<commit_before>//  Copyright (c) 2015 <NAME>. All rights reserved.

/// Returns a parser which maps parse trees into another type.
public func --> <C: CollectionType, T, U>(parser: Parser<C, T>.Function, f: (C, Range<C.Index>, T) -> U) -> Parser<C, U>.Function {
	return { input, sourcePos in
		parser(input, sourcePos).map { (f(input, sourcePos.index..<$1.index, $0), $1) }
	}
}


/// Returns a parser which maps parse results.
///
/// This enables e.g. adding identifiers for error handling.
public func --> <C: CollectionType, T, U> (parser: Parser<C, T>.Function, transform: Parser<C, T>.Result -> Parser<C, U>.Result) -> Parser<C, U>.Function {
	return parser >>> transform
}


import Prelude<commit_msg>Add an override for --><commit_after>//  Copyright (c) 2015 <NAME>. All rights reserved.

/// Returns a parser which maps parse trees into another type.
public func --> <C: CollectionType, T, U>(parser: Parser<C, T>.Function, f: (C, SourcePos<C.Index>, Range<C.Index>, T) -> U) -> Parser<C, U>.Function {
	return { input, inputPos in
		parser(input, inputPos).map { output, outputPos in
			(f(input, outputPos, inputPos.index..<outputPos.index, output), outputPos)
		}
	}
}

public func --> <C: CollectionType, T, U>(parser: Parser<C, T>.Function, f: (SourcePos<C.Index>, Range<C.Index>, T) -> U) -> Parser<C, U>.Function {
	return parser --> { f($1, $2, $3) }
}



/// Returns a parser which maps parse results.
///
/// This enables e.g. adding identifiers for error handling.
public func --> <C: CollectionType, T, U> (parser: Parser<C, T>.Function, transform: Parser<C, T>.Result -> Parser<C, U>.Result) -> Parser<C, U>.Function {
	return parser >>> transform
}


import Prelude
{'fraction_non_alphanumeric': 0.17928994082840236, 'fraction_numerical': 0.008284023668639054, 'mean_word_length': 3.7366946778711485, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2722742', 'n_tokens_mistral': 583, 'n_tokens_neox': 562, 'n_words': 186}