Skip to content

Commit

Permalink
Reorganize the lexer-related header inclusion scheme slightly. lexer.…
Browse files Browse the repository at this point in the history
…hpp is

now required to come before parser.hpp.

See #202.
  • Loading branch information
tzlaine committed Nov 29, 2024
1 parent 793e519 commit b6c1229
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
6 changes: 4 additions & 2 deletions include/boost/parser/lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/parser/parser_fwd.hpp>
#include <boost/parser/concepts.hpp>
#include <boost/parser/detail/debug_assert.hpp>
Expand Down Expand Up @@ -977,6 +981,4 @@ namespace boost { namespace parser {

}}

#include <boost/parser/token_parser.hpp>

#endif
5 changes: 3 additions & 2 deletions include/boost/parser/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8626,6 +8626,9 @@ namespace boost { namespace parser {

}}

#if defined(BOOST_PARSER_LEXER_HPP)
#include <boost/parser/token_parser.hpp>
#endif
#include <boost/parser/detail/printing_impl.hpp>

namespace boost { namespace parser {
Expand Down Expand Up @@ -9554,6 +9557,4 @@ namespace boost { namespace parser {
}
}}

#include <boost/parser/token_parser.hpp>

#endif
6 changes: 4 additions & 2 deletions include/boost/parser/token_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/parser/parser_fwd.hpp>
#include <boost/parser/concepts.hpp>
#include <boost/parser/error_handling.hpp>
Expand Down Expand Up @@ -237,4 +240,3 @@ namespace boost { namespace parser {
}}

#endif
#endif
1 change: 0 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions test/compile_include_parser_lexer.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion test/lexer_and_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* http://www.boost.org/LICENSE_1_0.txt)
*/

#include <boost/parser/parser.hpp>
#include <boost/parser/lexer.hpp>
#include <boost/parser/parser.hpp>

#include <boost/core/lightweight_test.hpp>

Expand Down

0 comments on commit b6c1229

Please sign in to comment.