Skip to content

Commit

Permalink
PHPDoc: Fixed exponential backtracking (#2198)
Browse files Browse the repository at this point in the history
This fixed the exponential backtracking of the pattern which matched PHP classes.
  • Loading branch information
RunDevelopment authored Feb 4, 2020
1 parent 984e5d2 commit 3b42536
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/prism-phpdoc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function (Prism) {

var typeExpression = /(?:[a-zA-Z]\w*|[|\\[\]])+/.source;
var typeExpression = /(?:\b[a-zA-Z]\w*|[|\\[\]])+/.source;

Prism.languages.phpdoc = Prism.languages.extend('javadoclike', {
'parameter': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-phpdoc.min.js

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

16 changes: 16 additions & 0 deletions tests/languages/phpdoc/issue2197.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @var Git_Driver_Gerrit_ProjectCreator_Factory */

----------------------------------------------------

[
"/** ",
["keyword", "@var"],
["class-name", [
"Git_Driver_Gerrit_ProjectCreator_Factory"
]],
" */"
]

----------------------------------------------------

Checks exponential backtracking for types. See #2197.

0 comments on commit 3b42536

Please sign in to comment.