<commit_before>function (check_dependencies)
	set (FOUND_DEPENDENCIES FALSE PARENT_SCOPE)

	find_package (FLEX QUIET)

	set (USE_HOMEBREW_BISON ${APPLE} AND EXISTS /usr/local/opt/bison) 
	if (USE_HOMEBREW_BISON) 
		list (APPEND CMAKE_PREFIX_PATH "/usr/local/opt/bison") 
	endif (USE_HOMEBREW_BISON)
	find_package (BISON 3 QUIET)

	if ((NOT FLEX_FOUND) AND (NOT BISON_FOUND))
		set (FAILURE_MESSAGE "Flex and Bison could not be found" PARENT_SCOPE)
		return ()
	endif ((NOT FLEX_FOUND) AND (NOT BISON_FOUND))
	if (NOT FLEX_FOUND)
		set (FAILURE_MESSAGE "Flex could not be found" PARENT_SCOPE)
		return ()
	endif (NOT FLEX_FOUND)
	if (NOT BISON_FOUND)
		set (FAILURE_MESSAGE "Bison could not be found" PARENT_SCOPE)
		return ()
	endif (NOT BISON_FOUND)

	set (FOUND_DEPENDENCIES TRUE PARENT_SCOPE)
endfunction (check_dependencies)

function (generate_code)
	set (GENERATED_CODE FALSE PARENT_SCOPE)

	flex_target (TOMLScanner ${CMAKE_CURRENT_SOURCE_DIR}/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.c)
	bison_target (TOMLParser
		      ${CMAKE_CURRENT_SOURCE_DIR}/parser.y
		      ${CMAKE_CURRENT_BINARY_DIR}/parser.c
		      VERBOSE
		      bison_verbose.txt)
	add_flex_bison_dependency (TOMLScanner TOMLParser)

	if ((NOT FLEX_TOMLScanner_DEFINED) AND (NOT BISON_TOMLParser_DEFINED))
		set (FAILURE_MESSAGE "Flex and Bison code could not be generated" PARENT_SCOPE)
		return ()
	endif ((NOT FLEX_TOMLScanner_DEFINED) AND (NOT BISON_TOMLParser_DEFINED))
	if (NOT FLEX_TOMLScanner_DEFINED)
		set (FAILURE_MESSAGE "Flex code could not be generated" PARENT_SCOPE)
		return ()
	endif (NOT FLEX_TOMLScanner_DEFINED)
	if (NOT BISON_TOMLParser_DEFINED)
		set (FAILURE_MESSAGE "Bison code could not be generated" PARENT_SCOPE)
		return ()
	endif (NOT BISON_TOMLParser_DEFINED)

	set (FLEX_OUTPUT_SOURCE ${FLEX_TOMLScanner_OUTPUTS} PARENT_SCOPE)
	set (FLEX_OUTPUT_HEADER ${FLEX_TOMLScanner_OUTPUT_HEADER} PARENT_SCOPE)
	set (BISON_OUTPUT_SOURCE ${BISON_TOMLParser_OUTPUT_SOURCE} PARENT_SCOPE)
	set (BISON_OUTPUT_HEADER ${BISON_TOMLParser_OUTPUT_HEADER} PARENT_SCOPE)

	set (GENERATED_CODE TRUE PARENT_SCOPE)

endfunction (generate_code)

if (DEPENDENCY_PHASE)

	check_dependencies ()
	if (NOT FOUND_DEPENDENCIES)
		remove_plugin (toml ${FAILURE_MESSAGE})
	else (NOT FOUND_DEPENDENCIES)
		generate_code ()
		if (NOT GENERATED_CODE)
			remove_plugin (toml ${FAILURE_MESSAGE})
		endif (NOT GENERATED_CODE)
	endif (NOT FOUND_DEPENDENCIES)

	set (SOURCE_FILES
	     toml.h
	     toml.c
	     driver.h
	     driver.c
	     scalar.h
	     scalar.c
	     table_array.h
	     table_array.c
	     comment_list.h
	     comment_list.c
	     codepoint.h
	     codepoint.c
	     utility.h
	     utility.c
		 write.h
		 write.c
		 node.h
		 node.c
		 prepare.c
		 prepare.h
		 type.h
		 type.c
	     error.h
	     error.c
	     ${FLEX_OUTPUT_HEADER}
	     ${FLEX_OUTPUT_SOURCE}
	     ${BISON_OUTPUT_HEADER}
	     ${BISON_OUTPUT_SOURCE})

endif (DEPENDENCY_PHASE)

add_plugin (toml
		ADD_TEST
		INSTALL_TEST_DATA
		LINK_ELEKTRA elektra-meta
	    SOURCES ${SOURCE_FILES}
	    INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})<commit_msg>toml: Reformatted CMakeLists<commit_after>function (check_dependencies)
	set (
		FOUND_DEPENDENCIES
		FALSE
		PARENT_SCOPE)

	find_package (FLEX QUIET)

	set (USE_HOMEBREW_BISON ${APPLE} AND EXISTS /usr/local/opt/bison)
	if (USE_HOMEBREW_BISON)
		list (APPEND CMAKE_PREFIX_PATH "/usr/local/opt/bison")
	endif (USE_HOMEBREW_BISON)
	find_package (BISON 3 QUIET)

	if ((NOT FLEX_FOUND) AND (NOT BISON_FOUND))
		set (
			FAILURE_MESSAGE
			"Flex and Bison could not be found"
			PARENT_SCOPE)
		return ()
	endif ((NOT FLEX_FOUND) AND (NOT BISON_FOUND))
	if (NOT FLEX_FOUND)
		set (
			FAILURE_MESSAGE
			"Flex could not be found"
			PARENT_SCOPE)
		return ()
	endif (NOT FLEX_FOUND)
	if (NOT BISON_FOUND)
		set (
			FAILURE_MESSAGE
			"Bison could not be found"
			PARENT_SCOPE)
		return ()
	endif (NOT BISON_FOUND)

	set (
		FOUND_DEPENDENCIES
		TRUE
		PARENT_SCOPE)
endfunction (check_dependencies)

function (generate_code)
	set (
		GENERATED_CODE
		FALSE
		PARENT_SCOPE)

	flex_target (TOMLScanner ${CMAKE_CURRENT_SOURCE_DIR}/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.c)
	bison_target (TOMLParser ${CMAKE_CURRENT_SOURCE_DIR}/parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.c VERBOSE bison_verbose.txt)
	add_flex_bison_dependency (TOMLScanner TOMLParser)

	if ((NOT FLEX_TOMLScanner_DEFINED) AND (NOT BISON_TOMLParser_DEFINED))
		set (
			FAILURE_MESSAGE
			"Flex and Bison code could not be generated"
			PARENT_SCOPE)
		return ()
	endif ((NOT FLEX_TOMLScanner_DEFINED) AND (NOT BISON_TOMLParser_DEFINED))
	if (NOT FLEX_TOMLScanner_DEFINED)
		set (
			FAILURE_MESSAGE
			"Flex code could not be generated"
			PARENT_SCOPE)
		return ()
	endif (NOT FLEX_TOMLScanner_DEFINED)
	if (NOT BISON_TOMLParser_DEFINED)
		set (
			FAILURE_MESSAGE
			"Bison code could not be generated"
			PARENT_SCOPE)
		return ()
	endif (NOT BISON_TOMLParser_DEFINED)

	set (
		FLEX_OUTPUT_SOURCE
		${FLEX_TOMLScanner_OUTPUTS}
		PARENT_SCOPE)
	set (
		FLEX_OUTPUT_HEADER
		${FLEX_TOMLScanner_OUTPUT_HEADER}
		PARENT_SCOPE)
	set (
		BISON_OUTPUT_SOURCE
		${BISON_TOMLParser_OUTPUT_SOURCE}
		PARENT_SCOPE)
	set (
		BISON_OUTPUT_HEADER
		${BISON_TOMLParser_OUTPUT_HEADER}
		PARENT_SCOPE)

	set (
		GENERATED_CODE
		TRUE
		PARENT_SCOPE)

endfunction (generate_code)

if (DEPENDENCY_PHASE)

	check_dependencies ()
	if (NOT FOUND_DEPENDENCIES)
		remove_plugin (toml ${FAILURE_MESSAGE})
	else (NOT FOUND_DEPENDENCIES)
		generate_code ()
		if (NOT GENERATED_CODE)
			remove_plugin (toml ${FAILURE_MESSAGE})
		endif (NOT GENERATED_CODE)
	endif (NOT FOUND_DEPENDENCIES)

	set (
		SOURCE_FILES
		toml.h
		toml.c
		driver.h
		driver.c
		scalar.h
		scalar.c
		table_array.h
		table_array.c
		comment_list.h
		comment_list.c
		codepoint.h
		codepoint.c
		utility.h
		utility.c
		write.h
		write.c
		node.h
		node.c
		prepare.c
		prepare.h
		type.h
		type.c
		error.h
		error.c
		${FLEX_OUTPUT_HEADER}
		${FLEX_OUTPUT_SOURCE}
		${BISON_OUTPUT_HEADER}
		${BISON_OUTPUT_SOURCE})

endif (DEPENDENCY_PHASE)

add_plugin (
	toml ADD_TEST INSTALL_TEST_DATA
	LINK_ELEKTRA elektra-meta
	SOURCES ${SOURCE_FILES}
	INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
{'fraction_non_alphanumeric': 0.07809983896940419, 'fraction_numerical': 0.00032206119162640903, 'mean_word_length': 4.4197207678883075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2207828', 'n_tokens_mistral': 2788, 'n_tokens_neox': 2441, 'n_words': 501}