<commit_before># Copyright 2006-2008 The FLWOR Foundation.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeUseBison.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeUseFlex.cmake)

SET(PARSER_SRCS
    symbol_table.cpp
    xquery_driver.cpp
    query_loc.cpp
    util.cpp)
    
SET(PARSER_BUILD_SRCS)

###################################################################
# Flex and Bison requirements

SET (BISON_REQUIRED_MAJOR "2")
SET (BISON_REQUIRED_MINOR "3")

SET (FLEX_REQUIRED_MAJOR "2")
SET (FLEX_REQUIRED_MINOR "5")
SET (FLEX_REQUIRED_REVISION "33")


###################################################################
# Bison checks 
SET (GENERATE_BISON_FILES TRUE)


INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeCompareVersionStrings.cmake)

# a and b need to be passed in by value
MACRO(COMPARE_VERSION a b)
  COMPARE_VERSION_STRINGS(${a} ${b} result)
    IF(result LESS 0)
        MESSAGE("${a} <  ${b}")
     ELSE(result LESS 0)
       IF(result GREATER 0)
         MESSAGE("${a} >  ${b}")
       ELSE(result GREATER 0)
          MESSAGE("${a} == ${b}")
       ENDIF(result GREATER 0)
     ENDIF(result LESS 0)
ENDMACRO(COMPARE_VERSION)

MESSAGE(STATUS "bison ${BISON_VERSION_FULL}")

COMPARE_VERSION(${BISON_VERSION_FULL} "2.3")

IF (BISON_MAJOR_VERSION LESS ${BISON_REQUIRED_MAJOR})
	SET (GENERATE_BISON_FILES FALSE)
ELSE (BISON_MAJOR_VERSION LESS ${BISON_REQUIRED_MAJOR})
	IF (BISON_MAJOR_VERSION EQUAL ${BISON_REQUIRED_MAJOR})
		IF (BISON_MINOR_VERSION LESS ${BISON_REQUIRED_MINOR})
			SET (GENERATE_BISON_FILES FALSE)
		ENDIF (BISON_MINOR_VERSION LESS ${BISON_REQUIRED_MINOR})
	ENDIF (BISON_MAJOR_VERSION EQUAL ${BISON_REQUIRED_MAJOR})
ENDIF (BISON_MAJOR_VERSION LESS ${BISON_REQUIRED_MAJOR})

IF (NOT BISON_EXECUTABLE)
	SET (GENERATE_BISON_FILES FALSE)
ENDIF (NOT BISON_EXECUTABLE)


# Bison setup for the parser
IF (GENERATE_BISON_FILES)
	SET(BISON_GENERATE_DEFINES TRUE)
	BISON_FILE(compiler/parser/xquery_parser.y)
	LIST(APPEND PARSER_BUILD_SRCS ${CMAKE_BINARY_DIR}/src/compiler/parser/xquery_parser.cpp)
	INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR}/src)
ELSE (GENERATE_BISON_FILES)
	IF (BISON_EXECUTABLE)
		MESSAGE(STATUS "Warning: GNU Bison's version " ${BISON_MAJOR_VERSION} "." ${BISON_MINOR_VERSION} " is less than required (" ${BISON_REQUIRED_MAJOR} "." ${BISON_REQUIRED_MINOR} ") -- the parser will not be regenerated")
		MESSAGE(STATUS "Warning: using repository files " ${CMAKE_CURRENT_SOURCE_DIR}/xquery_parser.cpp)
	ELSE (BISON_EXECUTABLE)
		MESSAGE("-- Warning: GNU Bison not available -- the parser will not be regenerated")
	ENDIF (BISON_EXECUTABLE)
	LIST(APPEND PARSER_SRCS xquery_parser.cpp)
ENDIF (GENERATE_BISON_FILES)<commit_msg>make the bison version checking use the new macro<commit_after># Copyright 2006-2008 The FLWOR Foundation.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeUseBison.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeUseFlex.cmake)

SET(PARSER_SRCS
    symbol_table.cpp
    xquery_driver.cpp
    query_loc.cpp
    util.cpp)
    
SET(PARSER_BUILD_SRCS)

###################################################################
# Flex and Bison requirements

SET (BISON_REQUIRED_MAJOR "2")
SET (BISON_REQUIRED_MINOR "3")

SET (FLEX_REQUIRED_MAJOR "2")
SET (FLEX_REQUIRED_MINOR "5")
SET (FLEX_REQUIRED_REVISION "33")


###################################################################
# Bison checks 
SET (GENERATE_BISON_FILES TRUE)


INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeCompareVersionStrings.cmake)

# a and b need to be passed in by value
MACRO(COMPARE_VERSION a b)
  COMPARE_VERSION_STRINGS(${a} ${b} result)
    IF(result LESS 0)
	    SET (GENERATE_BISON_FILES FALSE)
        MESSAGE(STATUS "Bison: ${a} <  ${b}")
     ELSE(result LESS 0)
       IF(result GREATER 0)
         MESSAGE(STATUS "Bison: ${a} >  ${b}")
       ELSE(result GREATER 0)
          MESSAGE(STATUS "Bison: ${a} == ${b}")
       ENDIF(result GREATER 0)
     ENDIF(result LESS 0)
ENDMACRO(COMPARE_VERSION)

COMPARE_VERSION(${BISON_VERSION_FULL} "2.3")


IF (NOT BISON_EXECUTABLE)
	SET (GENERATE_BISON_FILES FALSE)
ENDIF (NOT BISON_EXECUTABLE)


# Bison setup for the parser
IF (GENERATE_BISON_FILES)
	SET(BISON_GENERATE_DEFINES TRUE)
	BISON_FILE(compiler/parser/xquery_parser.y)
	LIST(APPEND PARSER_BUILD_SRCS ${CMAKE_BINARY_DIR}/src/compiler/parser/xquery_parser.cpp)
	INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR}/src)
ELSE (GENERATE_BISON_FILES)
	IF (BISON_EXECUTABLE)
		MESSAGE(STATUS "Warning: GNU Bison's version " ${BISON_MAJOR_VERSION} "." ${BISON_MINOR_VERSION} " is less than required (" ${BISON_REQUIRED_MAJOR} "." ${BISON_REQUIRED_MINOR} ") -- the parser will not be regenerated")
		MESSAGE(STATUS "Warning: using repository files " ${CMAKE_CURRENT_SOURCE_DIR}/xquery_parser.cpp)
	ELSE (BISON_EXECUTABLE)
		MESSAGE("-- Warning: GNU Bison not available -- the parser will not be regenerated")
	ENDIF (BISON_EXECUTABLE)
	LIST(APPEND PARSER_SRCS xquery_parser.cpp)
ENDIF (GENERATE_BISON_FILES)
{'fraction_non_alphanumeric': 0.13900826446280992, 'fraction_numerical': 0.00859504132231405, 'mean_word_length': 5.485530546623794, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1192852', 'n_tokens_mistral': 2257, 'n_tokens_neox': 2077, 'n_words': 521}