You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add cpp2 raw string literals support with interpolation (#251)
* Add string_parts
* Add raw_string struct
* Refactor expand_string_literal to use string_parts
Helper class that were used for raw string can replace expansion
of string literal.
* Add support for raw string literals in cpp2
* Add raw string interpolation support for cpp2
Raw-string literals that starts with $ (dollar sign) will interpolate.
That means that following code:
```cpp
rs := $R"(m["one"] + m["two"] = (m["one"] + m["two"])$)";
```
will generate follwing cpp1 code:
```cpp
auto rs { R"(m["one"] + m["two"] = )" + cpp2::to_string(cpp2::assert_in_bounds(m, "one") + cpp2::assert_in_bounds(m, "two")) };
```
It handles raw strings in single line and in multiple lines.
It process line by one and stores parts of multiline raw string in separate buffer (multiline_raw_strings).
* Add regression-tests
* Move `$R"` prefix out from is_encoding_prefix_and()
As there is only one place where there is a check for `$R"`
I have moved this check outside from is_encoding_prefix_and() function.
This prefix is now check directly after maching `$` in lex_line().
Update comment section of is_encoding_prefix_and() to include
all prefixes that are supported by the function.
0 commit comments