Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Removed Iter from wrapper and added it to the generated functions.
  • Loading branch information
MaxSagebaum committed Nov 12, 2024
commit baae569840d8cd8772837698331c07310d949e51
8 changes: 4 additions & 4 deletions include/cpp2regex.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ template<typename CharT, typename matcher_wrapper> class regular_expression;
#define CPP2_CPP2REGEX_H

template<typename matcher_wrapper, typename Iter, typename CharT>
using matcher_wrapper_type = typename matcher_wrapper::template wrap<Iter, CharT>;
using matcher_wrapper_type = typename matcher_wrapper::template wrap<CharT>;

template<typename matcher>
using matcher_context_type = typename matcher::context;
template<typename matcher, typename Iter>
using matcher_context_type = typename matcher::template context<Iter>;

#line 22 "cpp2regex.h2"
namespace cpp2 {
Expand Down Expand Up @@ -654,7 +654,7 @@ template<typename CharT, bool negate> [[nodiscard]] auto word_boundary_token_mat
template<typename CharT, typename matcher_wrapper> class regular_expression
{
public: template<typename Iter> using matcher = matcher_wrapper_type<matcher_wrapper,Iter,CharT>;// TODO: Remove when nested types are allowed: https://github.com/hsutter/cppfront/issues/727
public: template<typename Iter> using context = matcher_context_type<matcher<Iter>>;// TODO: Remove when nested types are allowed: https://github.com/hsutter/cppfront/issues/727
public: template<typename Iter> using context = matcher_context_type<matcher<Iter>,Iter>;// TODO: Remove when nested types are allowed: https://github.com/hsutter/cppfront/issues/727

public: template<typename Iter> class search_return
{
Expand Down
8 changes: 4 additions & 4 deletions include/cpp2regex.h2
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#define CPP2_CPP2REGEX_H

template<typename matcher_wrapper, typename Iter, typename CharT>
using matcher_wrapper_type = typename matcher_wrapper::template wrap<Iter, CharT>;
using matcher_wrapper_type = typename matcher_wrapper::template wrap<CharT>;

template<typename matcher>
using matcher_context_type = typename matcher::context;
template<typename matcher, typename Iter>
using matcher_context_type = typename matcher::template context<Iter>;

cpp2: namespace = {

Expand Down Expand Up @@ -771,7 +771,7 @@ word_boundary_token_matcher: <CharT, negate: bool> (inout cur, inout ctx) -> boo
regular_expression: <CharT, matcher_wrapper> type =
{
matcher: <Iter> type == matcher_wrapper_type<matcher_wrapper, Iter, CharT>; // TODO: Remove when nested types are allowed: https://github.com/hsutter/cppfront/issues/727
context: <Iter> type == matcher_context_type<matcher<Iter>>; // TODO: Remove when nested types are allowed: https://github.com/hsutter/cppfront/issues/727
context: <Iter> type == matcher_context_type<matcher<Iter>, Iter>; // TODO: Remove when nested types are allowed: https://github.com/hsutter/cppfront/issues/727

search_return: <Iter> type =
{
Expand Down
8 changes: 4 additions & 4 deletions source/reflect.h
Original file line number Diff line number Diff line change
Expand Up @@ -4167,7 +4167,7 @@ generation_function_context::generation_function_context(){}
auto cur {new_context()};

(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + cpp2::to_string(name) + ": @struct<noforward> type = {\n";
(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + " operator(): <Iter2> (this, cur: Iter2, inout ctx, other) -> cpp2::regex::match_return<Iter2> = {\n";
(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + " operator(): <Iter> (this, cur: Iter, inout ctx, other) -> cpp2::regex::match_return<Iter> = {\n";
(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + " r := ctx..pass(cur);\n";
(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + " do {\n";
(*cpp2::impl::assert_not_null(cpp2::move(cur))).add_tabs(3);
Expand Down Expand Up @@ -5523,12 +5523,12 @@ size_t i{0};
}

source += "{\n";
source += " wrap: <Iter, CharT> type = {\n"; // TODO: Remove wrapper when template template parameters are available.
source += " context: type == cpp2::regex::match_context<CharT, Iter, " + cpp2::to_string(parse_ctx.get_cur_group()) + ">;";
source += " wrap: <CharT> type = {\n"; // TODO: Remove wrapper when template template parameters are available.
source += " context: <Iter> type == cpp2::regex::match_context<CharT, Iter, " + cpp2::to_string(parse_ctx.get_cur_group()) + ">;";

generation_context gen_ctx {};
source += gen_ctx.run(parse_ctx.get_as_token());
source += " entry: (cur: Iter, inout ctx: context) -> cpp2::regex::match_return<Iter> = {\n";
source += " entry: <Iter> (cur: Iter, inout ctx: context<Iter>) -> cpp2::regex::match_return<Iter> = {\n";
source += " ctx..set_group_start(0, cur);\n";
source += " r := " + cpp2::to_string(gen_ctx.get_entry_func()) + "(cur, ctx, cpp2::regex::true_end_func());\n";
source += " if r.matched { ctx..set_group_end(0, r.pos); }\n";
Expand Down
8 changes: 4 additions & 4 deletions source/reflect.h2
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,7 @@ generation_context: type =
cur := new_context();

cur*.code += "(cur*.tabs)$(name)$: @struct<noforward> type = {\n";
cur*.code += "(cur*.tabs)$ operator(): <Iter2> (this, cur: Iter2, inout ctx, other) -> cpp2::regex::match_return<Iter2> = {\n";
cur*.code += "(cur*.tabs)$ operator(): <Iter> (this, cur: Iter, inout ctx, other) -> cpp2::regex::match_return<Iter> = {\n";
cur*.code += "(cur*.tabs)$ r := ctx..pass(cur);\n";
cur*.code += "(cur*.tabs)$ do {\n";
cur*..add_tabs(3);
Expand Down Expand Up @@ -3782,12 +3782,12 @@ regex_generator: <Error_out> type =
}

source += "{\n";
source += " wrap: <Iter, CharT> type = {\n"; // TODO: Remove wrapper when template template parameters are available.
source += " context: type == cpp2::regex::match_context<CharT, Iter, (parse_ctx..get_cur_group())$>;";
source += " wrap: <CharT> type = {\n"; // TODO: Remove wrapper when template template parameters are available.
source += " context: <Iter> type == cpp2::regex::match_context<CharT, Iter, (parse_ctx..get_cur_group())$>;";

gen_ctx: generation_context = ();
source += gen_ctx..run(parse_ctx..get_as_token());
source += " entry: (cur: Iter, inout ctx: context) -> cpp2::regex::match_return<Iter> = {\n";
source += " entry: <Iter> (cur: Iter, inout ctx: context<Iter>) -> cpp2::regex::match_return<Iter> = {\n";
source += " ctx..set_group_start(0, cur);\n";
source += " r := (gen_ctx..get_entry_func())$(cur, ctx, cpp2::regex::true_end_func());\n";
source += " if r.matched { ctx..set_group_end(0, r.pos); }\n";
Expand Down