Skip to content

Commit

Permalink
codify concept
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Mar 3, 2020
1 parent 7ee5d5b commit 2978c8b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/languages/c-like.js
Expand Up @@ -32,6 +32,10 @@ export default function(hljs) {
// https://en.cppreference.com/w/cpp/language/escape
// \\ \x \xFF \u2837 \u00323747 \374
var CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'
var END_GROUP_SAME_AS_BEGIN = {
'after:begin': (m, resp) => { resp.data.heredoc = m[1]; },
'before:end': (m, resp) => { if (resp.data.heredoc !== m[1]) resp.ignoreMatch(); }
};
var STRINGS = {
className: 'string',
variants: [
Expand All @@ -44,12 +48,10 @@ export default function(hljs) {
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", end: '\'',
illegal: '.'
},
{
Object.assign({
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
end: /\)([^()\\ ]{0,16})"/,
'after:begin': (m, resp) => { resp.data.heredoc = m[1]; },
'before:end': (m, resp) => { if (resp.data.heredoc !== m[1]) resp.ignoreMatch(); }
}
}, END_GROUP_SAME_AS_BEGIN)
]
};

Expand Down

0 comments on commit 2978c8b

Please sign in to comment.