Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions lisp/php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
(let ((tag (replace-regexp-in-string
(rx bos "v") ""
(shell-command-to-string "git describe --tags")))
(pattern (rx (group (+ any)) eol)))
(pattern (rx (group (+ nonl)) eol)))
(if (string-match pattern tag)
(match-string 0 tag)
(error "Faild to obtain git tag"))))
Expand Down Expand Up @@ -470,6 +470,12 @@ any) is a brace list.
PHP does not have an C-like \"enum\" keyword."
php nil)

;; cc-mode renamed `c-after-brace-list-decl-kwds' to `c-after-enum-list-kwds';
;; keep the old name defined so cc-langs' transitional lookup stays quiet where
;; the rename landed (see `c-after-enum-list-key' in cc-langs.el).
(c-lang-defconst c-after-brace-list-decl-kwds
php nil)

(c-lang-defconst c-typeless-decl-kwds
php (append (c-lang-const c-class-decl-kwds php) '("function" "const")))

Expand Down Expand Up @@ -1179,13 +1185,19 @@ After setting the stylevars run hook `php-mode-STYLENAME-hook'."
(setq-local comment-end "")
(setq-local page-delimiter php-mode-page-delimiter)

(setq-local font-lock-string-face 'php-string)
(setq-local font-lock-keyword-face 'php-keyword)
(setq-local font-lock-builtin-face 'php-builtin)
(setq-local c-preprocessor-face-name 'php-php-tag)
(setq-local font-lock-function-name-face 'php-function-name)
(setq-local font-lock-variable-name-face 'php-variable-name)
(setq-local font-lock-constant-face 'php-constant)
(with-suppressed-warnings ((obsolete font-lock-string-face
font-lock-keyword-face
font-lock-builtin-face
font-lock-function-name-face
font-lock-variable-name-face
font-lock-constant-face))
(setq-local font-lock-string-face 'php-string)
(setq-local font-lock-keyword-face 'php-keyword)
(setq-local font-lock-builtin-face 'php-builtin)
(setq-local c-preprocessor-face-name 'php-php-tag)
(setq-local font-lock-function-name-face 'php-function-name)
(setq-local font-lock-variable-name-face 'php-variable-name)
(setq-local font-lock-constant-face 'php-constant))

(setq-local syntax-propertize-function #'php-syntax-propertize-function)
(add-hook 'syntax-propertize-extend-region-functions
Expand Down
8 changes: 4 additions & 4 deletions lisp/php.el
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ which will be the name of the method."
(* (syntax whitespace))
"("
,@(when include-args
'((* any) line-end))))))
'((* nonl) line-end))))))

(defun php-create-regexp-for-classlike (type)
"Accepts a `TYPE' of a `classlike' object as a string, such as
Expand Down Expand Up @@ -378,7 +378,7 @@ can be used to match against definitions for that classlike."
(+ (or (syntax word) (syntax symbol)))
(* (syntax whitespace))
(? "=" (* (syntax whitespace))
(repeat 0 40 any))))
(repeat 0 40 nonl))))
1)
("Functions"
,(rx line-start
Expand All @@ -389,15 +389,15 @@ can be used to match against definitions for that classlike."
(+ (or (syntax word) (syntax symbol)))
(* (syntax whitespace))
"("
(repeat 0 100 any)))
(repeat 0 100 nonl)))
1)
("Import"
,(rx line-start
;; (* (syntax whitespace))
(group
"use"
(+ (syntax whitespace))
(repeat 0 100 any)))
(repeat 0 100 nonl)))
1)
("Classes"
,(php-create-regexp-for-classlike "\\(?:class\\|interface\\|trait\\|enum\\)") 0)
Expand Down
Loading