diff --git a/include/boost/parser/lexer.hpp b/include/boost/parser/lexer.hpp index d2052a1a..d88112b4 100644 --- a/include/boost/parser/lexer.hpp +++ b/include/boost/parser/lexer.hpp @@ -13,6 +13,10 @@ "In order to work, the Boost.Parser lexer requires C++20 and CTRE's ctre-unicode.hpp single-header file in the #include path. CTRE can be found at https://github.com/hanickadot/compile-time-regular-expressions . The required header is at https://raw.githubusercontent.com/hanickadot/compile-time-regular-expressions/refs/heads/main/single-header/ctre-unicode.hpp ." #endif +#if defined(BOOST_PARSER_PARSER_HPP) +#error "lexer.hpp must be included before parser.hpp." +#endif + #include #include #include @@ -977,6 +981,4 @@ namespace boost { namespace parser { }} -#include - #endif diff --git a/include/boost/parser/parser.hpp b/include/boost/parser/parser.hpp index 54b16347..738669e8 100644 --- a/include/boost/parser/parser.hpp +++ b/include/boost/parser/parser.hpp @@ -8623,6 +8623,9 @@ namespace boost { namespace parser { }} +#if defined(BOOST_PARSER_LEXER_HPP) +#include +#endif #include namespace boost { namespace parser { @@ -9551,6 +9554,4 @@ namespace boost { namespace parser { } }} -#include - #endif diff --git a/include/boost/parser/token_parser.hpp b/include/boost/parser/token_parser.hpp index 6ad2cb7f..3d729813 100644 --- a/include/boost/parser/token_parser.hpp +++ b/include/boost/parser/token_parser.hpp @@ -4,9 +4,12 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PARSER_TOKEN_PARSER_HPP -#if defined(BOOST_PARSER_PARSER_HPP) && defined(BOOST_PARSER_LEXER_HPP) #define BOOST_PARSER_TOKEN_PARSER_HPP +#if !defined(BOOST_PARSER_PARSER_HPP) || !defined(BOOST_PARSER_LEXER_HPP) +#error "token_parser.hpp must be included after lexer.hpp and parser.hpp." +#endif + #include #include #include @@ -237,4 +240,3 @@ namespace boost { namespace parser { }} #endif -#endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 878c8c49..b4235315 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -49,7 +49,6 @@ add_test(NAME parser_api COMMAND parser_api) add_executable( compile_tests compile_include_lexer_parser.cpp - compile_include_parser_lexer.cpp compile_tests_main.cpp compile_attribute.cpp compile_seq_attribute.cpp diff --git a/test/compile_include_parser_lexer.cpp b/test/compile_include_parser_lexer.cpp deleted file mode 100644 index 343b1988..00000000 --- a/test/compile_include_parser_lexer.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2024 T. Zachary Laine -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#if BOOST_PARSER_USE_CONCEPTS -#include -#endif diff --git a/test/lexer_and_parser.cpp b/test/lexer_and_parser.cpp index 71cbed65..50a34ced 100644 --- a/test/lexer_and_parser.cpp +++ b/test/lexer_and_parser.cpp @@ -6,8 +6,8 @@ * http://www.boost.org/LICENSE_1_0.txt) */ -#include #include +#include #include