Skip to content

Commit

Permalink
D: Regexp optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Oct 22, 2017
1 parent 438926c commit 16b338f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/prism-d.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Prism.languages.d = Prism.languages.extend('clike', {
'string': [
// r"", x""
/\b[rx]"(\\.|[^\\"])*"[cwd]?/,
/\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/,
// q"[]", q"()", q"<>", q"{}"
/\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,
// q"IDENT
Expand All @@ -13,7 +13,7 @@ Prism.languages.d = Prism.languages.extend('clike', {
// Characters
/'(?:\\'|\\?[^']+)'/,

/(["`])(\\.|(?!\1)[^\\])*\1[cwd]?/
/(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/
],

'number': [
Expand Down Expand Up @@ -46,7 +46,7 @@ Prism.languages.d.comment = [
Prism.languages.insertBefore('d', 'comment', {
'token-string': {
// Allow one level of nesting
pattern: /\bq\{(?:|\{[^}]*\}|[^}])*\}/,
pattern: /\bq\{(?:\{[^}]*\}|[^}])*\}/,
alias: 'string'
}
});
Expand Down
2 changes: 1 addition & 1 deletion components/prism-d.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 16b338f

Please sign in to comment.