Skip to content

Commit baae569

Browse files
committed
Removed Iter from wrapper and added it to the generated functions.
1 parent b536b8e commit baae569

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

include/cpp2regex.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ template<typename CharT, typename matcher_wrapper> class regular_expression;
9797
#define CPP2_CPP2REGEX_H
9898

9999
template<typename matcher_wrapper, typename Iter, typename CharT>
100-
using matcher_wrapper_type = typename matcher_wrapper::template wrap<Iter, CharT>;
100+
using matcher_wrapper_type = typename matcher_wrapper::template wrap<CharT>;
101101

102-
template<typename matcher>
103-
using matcher_context_type = typename matcher::context;
102+
template<typename matcher, typename Iter>
103+
using matcher_context_type = typename matcher::template context<Iter>;
104104

105105
#line 22 "cpp2regex.h2"
106106
namespace cpp2 {
@@ -654,7 +654,7 @@ template<typename CharT, bool negate> [[nodiscard]] auto word_boundary_token_mat
654654
template<typename CharT, typename matcher_wrapper> class regular_expression
655655
{
656656
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
657-
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
657+
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
658658

659659
public: template<typename Iter> class search_return
660660
{

include/cpp2regex.h2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
#define CPP2_CPP2REGEX_H
1515

1616
template<typename matcher_wrapper, typename Iter, typename CharT>
17-
using matcher_wrapper_type = typename matcher_wrapper::template wrap<Iter, CharT>;
17+
using matcher_wrapper_type = typename matcher_wrapper::template wrap<CharT>;
1818

19-
template<typename matcher>
20-
using matcher_context_type = typename matcher::context;
19+
template<typename matcher, typename Iter>
20+
using matcher_context_type = typename matcher::template context<Iter>;
2121

2222
cpp2: namespace = {
2323

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

776776
search_return: <Iter> type =
777777
{

source/reflect.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,7 +4167,7 @@ generation_function_context::generation_function_context(){}
41674167
auto cur {new_context()};
41684168

41694169
(*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";
4170-
(*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";
4170+
(*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";
41714171
(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + " r := ctx..pass(cur);\n";
41724172
(*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + " do {\n";
41734173
(*cpp2::impl::assert_not_null(cpp2::move(cur))).add_tabs(3);
@@ -5523,12 +5523,12 @@ size_t i{0};
55235523
}
55245524

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

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

source/reflect.h2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ generation_context: type =
23642364
cur := new_context();
23652365

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

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

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

0 commit comments

Comments
 (0)