Skip to content
Merged
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
5 changes: 2 additions & 3 deletions cpp/include/cudf/strings/regex/regex_program.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -46,6 +46,7 @@ struct regex_program {
regex_program() = delete;
regex_program(regex_program const&) = delete;
regex_program& operator=(regex_program const&) = delete;
~regex_program();

/**
* @brief Move constructor
Expand Down Expand Up @@ -105,8 +106,6 @@ struct regex_program {
*/
[[nodiscard]] std::size_t compute_working_memory_size(int32_t num_strings) const;

~regex_program();

private:
std::string _pattern;
regex_flags _flags;
Expand Down
12 changes: 7 additions & 5 deletions cpp/src/strings/regex/regcomp.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -1071,14 +1071,16 @@ reprog reprog::create_from(std::string_view pattern,
regex_flags const flags,
capture_groups const capture)
{
reprog rtn;
reprog rtn(flags);
auto pattern32 = string_to_char32_vector(pattern);
regex_compiler const compiler(pattern32.data(), flags, capture, rtn);
// for debugging, it can be helpful to call rtn.print(flags) here to dump
// for debugging, it can be helpful to call rtn.print() here to dump
// out the instructions that have been created from the given pattern
return rtn;
}

reprog::reprog(regex_flags flags) : _flags{flags} {}

void reprog::optimize() { collapse_nops(); }

void reprog::finalize() { build_start_ids(); }
Expand Down Expand Up @@ -1247,9 +1249,9 @@ match_flags reprog::compute_match_flags() const
}

#ifndef NDEBUG
void reprog::print(regex_flags const flags)
void reprog::print() const
{
printf("Flags = 0x%08x\n", static_cast<uint32_t>(flags));
printf("Flags = 0x%08x\n", static_cast<uint32_t>(_flags));
printf("Instructions:\n");
for (std::size_t i = 0; i < _insts.size(); i++) {
reinst const& inst = _insts[i];
Expand Down
7 changes: 4 additions & 3 deletions cpp/src/strings/regex/regcomp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -138,7 +138,7 @@ class reprog {
[[nodiscard]] match_flags compute_match_flags() const;

#ifndef NDEBUG
void print(regex_flags const flags);
void print() const;
#endif

private:
Expand All @@ -147,8 +147,9 @@ class reprog {
int32_t _startinst_id{}; // id of first instruction
std::vector<int32_t> _startinst_ids; // short-cut to speed-up ORs
int32_t _num_capturing_groups{};
[[maybe_unused]] regex_flags _flags{};

reprog() = default;
reprog(regex_flags);
void collapse_nops();
void build_start_ids();
void check_for_errors(int32_t id, int32_t next_id);
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/strings/search/count.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -49,6 +49,7 @@ struct counter_fn {
return count;
}
};
} // namespace

std::unique_ptr<column> count(strings_column_view const& input,
string_scalar const& target,
Expand Down Expand Up @@ -78,7 +79,6 @@ std::unique_ptr<column> count(strings_column_view const& input,

return results;
}
} // namespace

} // namespace detail

Expand Down
Loading