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

/// Convenience for describing the types of parser combinators.
///
/// \param Tree  The type of parse tree generated by the parser.
public struct Parser<C: CollectionType, Tree> {
	/// The type of parser combinators.
	public typealias Function = (C, C.Index) -> Result

	/// The type produced by parser combinators.
	public typealias Result = (Tree, C.Index)?
}


/// Parses `input` with `parser`, returning the parse trees or `nil` if nothing could be parsed, or if parsing did not consume the entire input.
public func parse<C: CollectionType, Tree>(parser: Parser<C, Tree>.Function, input: C) -> Tree? {
	return parser(input, input.startIndex).map { $1 == input.endIndex ? $0 : nil } ?? nil
}
<commit_msg>Parser is an empty enum, to indicate that it cannot be instantiated.<commit_after>//  Copyright (c) 2014 <NAME>. All rights reserved.

/// Convenience for describing the types of parser combinators.
///
/// \param Tree  The type of parse tree generated by the parser.
public enum Parser<C: CollectionType, Tree> {
	/// The type of parser combinators.
	public typealias Function = (C, C.Index) -> Result

	/// The type produced by parser combinators.
	public typealias Result = (Tree, C.Index)?
}


/// Parses `input` with `parser`, returning the parse trees or `nil` if nothing could be parsed, or if parsing did not consume the entire input.
public func parse<C: CollectionType, Tree>(parser: Parser<C, Tree>.Function, input: C) -> Tree? {
	return parser(input, input.startIndex).map { $1 == input.endIndex ? $0 : nil } ?? nil
}

{'fraction_non_alphanumeric': 0.12072184194150591, 'fraction_numerical': 0.0074673304293715, 'mean_word_length': 3.743362831858407, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '192609', 'n_tokens_mistral': 477, 'n_tokens_neox': 461, 'n_words': 204}