Skip to content

Commit 8cd3f5d

Browse files
authored
Merge pull request #681 from emacs-php/refactor/regexp-beginning-of-defun
Refactor RegExp for beginning of defun
2 parents 55c59ea + b3a0445 commit 8cd3f5d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: lisp/php.el

+11-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,17 @@ it is the character that will terminate the string, or t if the string should be
223223
(bound-and-true-p poly-php-html-mode))
224224

225225
(defconst php-beginning-of-defun-regexp
226-
"^\\s-*\\(?:\\(?:abstract\\|final\\|private\\|protected\\|public\\|static\\)\\s-+\\)*function\\s-+&?\\(\\(\\sw\\|\\s_\\)+\\)\\s-*("
226+
(eval-when-compile
227+
(rx bol
228+
(* (syntax whitespace))
229+
(* (or "abstract" "final" "private" "protected" "public" "static")
230+
(+ (syntax whitespace)))
231+
"function"
232+
(+ (syntax whitespace))
233+
(? "&" (* (syntax whitespace)))
234+
(group (+ (or (syntax word) (syntax symbol))))
235+
(* (syntax whitespace))
236+
"("))
227237
"Regular expression for a PHP function.")
228238

229239
(eval-when-compile

0 commit comments

Comments
 (0)