protected function parseRoutes($routes)
	{
		$tree = [];

		foreach ($routes as $Route) {
			$node = &$tree;
			$routeSegments = $this->normalize($Route->route);

			foreach ($routeSegments as $segment) {
				if (!isset($node[$segment["use"]])) {
					$node[$segment["use"]] = [
						"name" => $segment["name"],
						"routeName" => $Route->name
					];
				}
				$node = &$node[$segment["use"]];
			}
			$Route->segments = $routeSegments;
			//node exec can exists only if a route is already added.
			//This happens when a route is added more than once with different methods.
			$node["exec"]["method"][$Route->method] = $Route;
		}

		return $tree;
	}