<commit_before><?php

	namespace Hippo;

	use Hippo\File;
	use Hippo\Token;
	use Hippo\TokenList;

	/**
	 * Tokenizes a file.
	 * @package Hippo
	 * @author <NAME> <<EMAIL>>
	 */
	class Tokenizer {
		private $_blockIndent = array('(', '{', T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES);
		private $_blockOutdent = array(')', '}');

		/**
		 * Performs tokenization on the file
		 * @param  File $file
		 * @return TokenList
		 */
		public function tokenize(File $file) {
			$line   = 1;
			$column = 1;
			$level  = 0;

			$namespaceFound = false;
			$namespace      = null;
			$namespaceLevel = null;

			$tokenList = new TokenList;
			$tokens = token_get_all($file->getSource());

			foreach ($tokens as $token) {
				if (is_array($token)) {
					$type   = $token[0];
					$lexeme = $token[1];
				} else {
					$type   = $token;
					$lexeme = $token;
				}

				$token = new Token($type, $lexeme, $line, $column);

				if ($token->hasNewline()) {
					$line += $token->getNewLineCount();
					$column = 1 + $token->getTrailingLineLength();
				} else {
					$column += $token->getLength();
				}

				// Namespace handling.<commit_msg>Reduce if condition<commit_after><?php

	namespace Hippo;

	use Hippo\File;
	use Hippo\Token;
	use Hippo\TokenList;

	/**
	 * Tokenizes a file.
	 * @package Hippo
	 * @author <NAME> <<EMAIL>>
	 */
	class Tokenizer {
		private $_blockIndent = array('(', '{', T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES);
		private $_blockOutdent = array(')', '}');

		/**
		 * Performs tokenization on the file
		 * @param  File $file
		 * @return TokenList
		 */
		public function tokenize(File $file) {
			$line   = 1;
			$column = 1;
			$level  = 0;

			$namespaceFound = false;
			$namespace      = null;
			$namespaceLevel = null;

			$tokenList = new TokenList;
			$tokens = token_get_all($file->getSource());

			foreach ($tokens as $token) {
				$type = is_array($token) ? $token[0] : $token;
				$lexeme = is_array($token) ? $token[1] : $token;

				$token = new Token($type, $lexeme, $line, $column);

				if ($token->hasNewline()) {
					$line += $token->getNewLineCount();
					$column = 1 + $token->getTrailingLineLength();
				} else {
					$column += $token->getLength();
				}

				// Namespace handling.
{'fraction_non_alphanumeric': 0.1668903803131991, 'fraction_numerical': 0.005369127516778523, 'mean_word_length': 2.92280701754386, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '6852228', 'n_tokens_mistral': 972, 'n_tokens_neox': 778, 'n_words': 180}