File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,16 @@ function(hljs) {
1515 className : 'string' ,
1616 variants : [
1717 {
18- begin : '(u8?|U)?L ?"' , end : '"' ,
18+ begin : '(u8?|U|L) ?"' , end : '"' ,
1919 illegal : '\\n' ,
2020 contains : [ hljs . BACKSLASH_ESCAPE ]
2121 } ,
2222 {
23- begin : '(u8?|U)?R"' , end : '"' ,
24- contains : [ hljs . BACKSLASH_ESCAPE ]
23+ // TODO: This does not handle raw string literals with prefixes. Using
24+ // a single regex with backreferences would work (note to use *?
25+ // instead of * to make it non-greedy), but the mode.terminators
26+ // computation in highlight.js breaks the counting.
27+ begin : '(u8?|U|L)?R"\\(' , end : '\\)"' ,
2528 } ,
2629 {
2730 begin : '\'\\\\?.' , end : '\'' ,
Original file line number Diff line number Diff line change 99
1010<span class="hljs-comment">// Raw string literals (multiline)</span>
1111<span class="hljs-keyword">auto</span> char_multi = <span class="hljs-string">R"(Hello
12- normal
12+ " normal"
1313muliline
1414string.)"</span>;
1515<span class="hljs-keyword">auto</span> utf8_multi = <span class="hljs-string">u8R"(Hello
16- utf-8
16+ " utf-8"
1717muliline
1818string)"</span>;
1919<span class="hljs-keyword">auto</span> utf16_multi = <span class="hljs-string">uR"(Hello
20- utf-16
20+ " utf-16"
2121muliline
2222string)"</span>;
2323<span class="hljs-keyword">auto</span> utf32_multi = <span class="hljs-string">UR"(Hello
24- utf-32
24+ " utf-32"
2525muliline
2626string)"</span>;
2727
Original file line number Diff line number Diff line change @@ -9,19 +9,19 @@ auto wide_char = L"Hello wchar_t string";
99
1010// Raw string literals (multiline)
1111auto char_multi = R"(Hello
12- normal
12+ " normal"
1313muliline
1414string.)";
1515auto utf8_multi = u8R"(Hello
16- utf-8
16+ " utf-8"
1717muliline
1818string)";
1919auto utf16_multi = uR"(Hello
20- utf-16
20+ " utf-16"
2121muliline
2222string)";
2323auto utf32_multi = UR"(Hello
24- utf-32
24+ " utf-32"
2525muliline
2626string)";
2727
You can’t perform that action at this time.
0 commit comments