Skip to content

Commit 7a554b5

Browse files
Fixed several cases of exponential backtracking (#2268)
1 parent 8704cdf commit 7a554b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+122
-100
lines changed

components/prism-antlr4.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Prism.languages.antlr4 = {
3131
}
3232
},
3333
'command': {
34-
pattern: /(->\s*)(?:\s*(?:,\s*)?[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,
34+
pattern: /(->\s*)(?:\s*(?:,\s*)?\b[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,
3535
lookbehind: true,
3636
inside: {
3737
'function': /\b\w+(?=\s*(?:[,(]|$))/,

components/prism-antlr4.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-applescript.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Prism.languages.applescript = {
22
'comment': [
33
// Allow one level of nesting
4-
/\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/,
4+
/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,
55
/--.+/,
66
/#.+/
77
],
@@ -17,4 +17,4 @@ Prism.languages.applescript = {
1717
alias: 'builtin'
1818
},
1919
'punctuation': /[{}():,¬«»]/
20-
};
20+
};

components/prism-applescript.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-asciidoc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
Those do not have the restrictions of the constrained quotes.
150150
They are, in order: __emphasis__, **strong**, ++monospace++, +++passthrough+++, ##unquoted##, $$passthrough$$, ~subscript~, ^superscript^, {attribute-reference}, [[anchor]], [[[bibliography anchor]]], <<xref>>, (((indexes))) and ((indexes))
151151
*/
152-
pattern: /(^|[^\\])(?:(?:\B\[(?:[^\]\\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(?:\r?\n|\r).+?)*\)?\)\)))/m,
153153
lookbehind: true,
154154
inside: {
155155
'attributes': attributes,

components/prism-asciidoc.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-c.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Prism.languages.insertBefore('c', 'string', {
2323
inside: {
2424
// highlight the path of the include statement as a string
2525
'string': {
26-
pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,
26+
pattern: /(#\s*include\s*)(?:<.+?>|(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2)/,
2727
lookbehind: true
2828
},
2929
// highlight macro directives as keywords

0 commit comments

Comments
 (0)