Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a few cases of exponential backtracking #2268

Merged
merged 12 commits into from Apr 16, 2020
2 changes: 1 addition & 1 deletion components/prism-antlr4.js
Expand Up @@ -31,7 +31,7 @@ Prism.languages.antlr4 = {
}
},
'command': {
pattern: /(->\s*)(?:\s*(?:,\s*)?[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,
pattern: /(->\s*)(?:\s*(?:,\s*)?\b[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,
lookbehind: true,
inside: {
'function': /\b\w+(?=\s*(?:[,(]|$))/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-antlr4.min.js

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

4 changes: 2 additions & 2 deletions components/prism-applescript.js
@@ -1,7 +1,7 @@
Prism.languages.applescript = {
'comment': [
// Allow one level of nesting
/\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/,
/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,
/--.+/,
/#.+/
],
Expand All @@ -17,4 +17,4 @@ Prism.languages.applescript = {
alias: 'builtin'
},
'punctuation': /[{}():,¬«»《》]/
};
};
2 changes: 1 addition & 1 deletion components/prism-applescript.min.js

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

2 changes: 1 addition & 1 deletion components/prism-asciidoc.js
Expand Up @@ -149,7 +149,7 @@
Those do not have the restrictions of the constrained quotes.
They are, in order: __emphasis__, **strong**, ++monospace++, +++passthrough+++, ##unquoted##, $$passthrough$$, ~subscript~, ^superscript^, {attribute-reference}, [[anchor]], [[[bibliography anchor]]], <<xref>>, (((indexes))) and ((indexes))
*/
pattern: /(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?: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?)*\)?\)\)))/m,
lookbehind: true,
inside: {
'attributes': attributes,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-asciidoc.min.js

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

2 changes: 1 addition & 1 deletion components/prism-c.js
Expand Up @@ -23,7 +23,7 @@ Prism.languages.insertBefore('c', 'string', {
inside: {
// highlight the path of the include statement as a string
'string': {
pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,
pattern: /(#\s*include\s*)(?:<.+?>|(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2)/,
lookbehind: true
},
// highlight macro directives as keywords
Expand Down