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

import Set

extension Combinator {
	/// Parse a sequence element by element and return the corresponding parse trees (if any).
	func parse<S : Sequence where S.GeneratorType.Element == Alphabet>(sequence: S) -> Set<Alphabet> {
		return parseForest(reduce(sequence, self) { parser, term in
			derive(parser, term).compact()
		})
	}
}

struct ParsingTests : Testable {
	static func _performTests() {
	}
}<commit_msg>Test parsing the empty string.<commit_after>//  Copyright (c) 2014 <NAME>. All rights reserved.

import Set

extension Combinator {
	/// Parse a sequence element by element and return the corresponding parse trees (if any).
	func parse<S : Sequence where S.GeneratorType.Element == Alphabet>(sequence: S) -> Set<Alphabet> {
		return parseForest(reduce(sequence, self) { parser, term in
			derive(parser, term).compact()
		})
	}
}

struct ParsingTests : Testable {
	static func _performTests() {
		let xs = Combinator(literal: "x")*
		let nullParses = xs.parse([""])
		assert(nullParses.count == 0)
	}
}
{'fraction_non_alphanumeric': 0.12269372693726938, 'fraction_numerical': 0.008302583025830259, 'mean_word_length': 4.266990291262136, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '2055501', 'n_tokens_mistral': 356, 'n_tokens_neox': 329, 'n_words': 109}