Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ubuntu24.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Ubuntu

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
build:
strategy:
fail-fast: false
matrix:
compiler_version: [g++-13, g++-14, clang++-20]
cxx_std: [20, 23]
os: [ubuntu-24.04]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Install Clang 20
id: install_clang_20
if: matrix.compiler_version == 'clang++-20'
shell: bash
working-directory: ${{ env.HOME }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
sudo apt-get install libc++-20-dev libc++abi-20-dev libunwind-20-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler_version }} -DCXX_STD=${{ matrix.cxx_std }}

- name: Build
run: cd build ; make -j4

- name: Test
run: cd build ; make check
5 changes: 3 additions & 2 deletions include/boost/parser/detail/text/detail/all_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ namespace boost::parser::detail::text::detail {
template<typename R>
constexpr bool view =
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS || \
(defined(__cpp_lib_concepts) && \
(!defined(BOOST_PARSER_GCC) || 12 <= __GNUC__))
(defined(__cpp_lib_ranges) && \
(!defined(BOOST_PARSER_GCC) || 12 <= __GNUC__) && \
(!defined(__clang_major__) || 16 <= __clang_major__))
std::ranges::view<R>
#else
range_<R> && !container_<R> &&
Expand Down
27 changes: 12 additions & 15 deletions include/boost/parser/search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,25 @@ namespace boost::parser {
constexpr auto as_utf<text::format::utf32> =
text::detail::as_utf_impl<text::utf32_view, text::format::utf32>{};

template<typename R>
constexpr bool has_special_sentinel_v =
std::is_same_v<sentinel_t<remove_cv_ref_t<R>>, null_sentinel_t> ||
text::detail::is_bounded_array_v<remove_cv_ref_t<R>>;

template<
typename R_,
bool ToCommonRange = false,
text::format OtherRangeFormat = no_format,
bool = std::is_same_v<sentinel_t<remove_cv_ref_t<R_>>,
null_sentinel_t> ||
text::detail::is_bounded_array_v<remove_cv_ref_t<R_>>>
bool HasSpecialSentinel = has_special_sentinel_v<R_>>
struct to_range
{
template<typename R>
static constexpr auto call(R && r)
{
static_assert(std::is_same_v<R, R_>);
using T = remove_cv_ref_t<R>;
if constexpr (std::is_same_v<sentinel_t<T>, null_sentinel_t>) {
if constexpr (HasSpecialSentinel &&
std::is_same_v<sentinel_t<T>, null_sentinel_t>) {
auto plus_strlen = [](auto * ptr) {
while (*ptr) {
++ptr;
Expand All @@ -63,7 +67,8 @@ namespace boost::parser {
return (R &&) r | as_utf<OtherRangeFormat>;
}
}
} else if constexpr (text::detail::is_bounded_array_v<T>) {
} else if constexpr (HasSpecialSentinel &&
text::detail::is_bounded_array_v<T>) {
auto const first = std::begin(r);
auto last = std::end(r);
constexpr auto n = std::extent_v<T>;
Expand All @@ -75,22 +80,14 @@ namespace boost::parser {
return BOOST_PARSER_SUBRANGE(first, last) |
as_utf<OtherRangeFormat>;
}
} else if constexpr (OtherRangeFormat == no_format) {
return (R &&) r;
} else {
return (R &&) r | as_utf<OtherRangeFormat>;
}
}
};

template<typename R_, bool ToCommonRange>
struct to_range<R_, ToCommonRange, no_format, false>
{
template<typename R>
static constexpr R && call(R && r)
{
return (R &&) r;
}
};

template<typename R>
using to_range_t = decltype(to_range<R>::call(std::declval<R>()));

Expand Down