Skip to content

Commit 28ae594

Browse files
committed
Fixes for generation.
1 parent b7a4478 commit 28ae594

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/cpp2regex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ class modifier_token: public regex_token_base {
12421242
#line 1900 "regex.h2"
12431243
private: std::string mod;
12441244

1245-
public: explicit modifier_token(cpp2::in<std::string> mod_);
1245+
public: explicit modifier_token(cpp2::in<std::string> mod_, cpp2::in<std::string> mod_str);
12461246

12471247
#line 1907 "regex.h2"
12481248
public: auto generate_code(generation_context& ctx) const -> void override;
@@ -3108,7 +3108,7 @@ template<typename CharT, CharT C, CharT L, CharT U> [[nodiscard]] auto char_toke
31083108

31093109
static_cast<void>(CPP2_UFCS(next)(ctx));// Skip escape
31103110

3111-
if (std::string::npos != CPP2_UFCS(find)(std::string("afenrt"), CPP2_UFCS(current)(ctx))) {
3111+
if (std::string::npos != CPP2_UFCS(find)(std::string("afenrt\\"), CPP2_UFCS(current)(ctx))) {
31123112
// Escape of string special char
31133113
return CPP2_UFCS_TEMPLATE(cpp2_new<escaped_char_token>)(cpp2::shared, CPP2_UFCS(current)(ctx));
31143114
}else {
@@ -3412,7 +3412,7 @@ template<typename CharT, int group> [[nodiscard]] auto group_ref_token_matcher(a
34123412
// Only a modifier
34133413
CPP2_UFCS(set_modifiers)(ctx, std::move(modifiers_change_to));
34143414

3415-
return CPP2_UFCS_TEMPLATE(cpp2_new<modifier_token>)(cpp2::shared, std::move(modifier_change));
3415+
return CPP2_UFCS_TEMPLATE(cpp2_new<modifier_token>)(cpp2::shared, std::move(modifier_change), std::move(modifiers));
34163416
}
34173417
}
34183418

@@ -3510,8 +3510,8 @@ template<typename CharT, int group> [[nodiscard]] auto group_ref_token_matcher(a
35103510
}
35113511

35123512
#line 1902 "regex.h2"
3513-
modifier_token::modifier_token(cpp2::in<std::string> mod_)
3514-
: regex_token_base{ ("(?" + cpp2::to_string(mod_) + ")") }
3513+
modifier_token::modifier_token(cpp2::in<std::string> mod_, cpp2::in<std::string> mod_str)
3514+
: regex_token_base{ ("(?" + cpp2::to_string(mod_str) + ")") }
35153515
, mod{ mod_ }{
35163516

35173517
#line 1905 "regex.h2"

source/regex.h2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ escape_token_parse: (inout ctx: parse_context) -> token_ptr = {
14871487

14881488
_ = ctx.next(); // Skip escape
14891489

1490-
if std::string::npos != std::string("afenrt").find(ctx.current()) {
1490+
if std::string::npos != std::string("afenrt\\").find(ctx.current()) {
14911491
// Escape of string special char
14921492
return shared.new<escaped_char_token>(ctx.current());
14931493
} else {
@@ -1800,7 +1800,7 @@ group_token: @polymorphic_base type = {
18001800
// Only a modifier
18011801
ctx.set_modifiers(modifiers_change_to);
18021802

1803-
return shared.new<modifier_token>(modifier_change);
1803+
return shared.new<modifier_token>(modifier_change, modifiers);
18041804
}
18051805
}
18061806

@@ -1899,8 +1899,8 @@ modifier_token: @polymorphic_base type = {
18991899

19001900
mod: std::string;
19011901

1902-
operator=: (out this, mod_: std::string) = {
1903-
regex_token_base = ("(?(mod_)$)");
1902+
operator=: (out this, mod_: std::string, mod_str: std::string) = {
1903+
regex_token_base = ("(?(mod_str)$)");
19041904
mod = mod_;
19051905
}
19061906

0 commit comments

Comments
 (0)