Skip to content
Merged
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
2 changes: 1 addition & 1 deletion lisp/php-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
:group 'php-faces
:tag "PHP Constant")

(defface php-constant-assign '((t (:inherit font-lock-type-face)))
(defface php-constant-assign '((t (:inherit php-constant)))
"PHP Mode face used to highlight constant assigning (\"const\" statement)."
:group 'php-faces
:tag "PHP Constant Assign")
Expand Down
14 changes: 7 additions & 7 deletions lisp/php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,10 @@ PHP does not have an C-like \"enum\" keyword."
php nil)

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

(c-lang-defconst c-modifier-kwds
php '("abstract" "const" "final" "static" "case" "readonly"))
php '("abstract" "final" "static" "case" "readonly"))

(c-lang-defconst c-protection-kwds
"Access protection label keywords in classes."
Expand Down Expand Up @@ -1396,11 +1396,6 @@ for \\[find-tag] (which see)."
("\\_<\\(?:implements\\|extends\\)\\_>" . 'php-class-declaration-spec)
;; Namespace declaration
("\\_<namespace\\_>" . 'php-namespace-declaration)
;; import constant statement
(,(rx symbol-start (group "use" (+ (syntax whitespace)) "const")
(+ (syntax whitespace)))
(1 'php-import-declaration)
(,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-constant-assign)))
;; import statement
("\\_<use\\_>" . 'php-import-declaration)
;; Class modifiers (abstract, final)
Expand Down Expand Up @@ -1488,6 +1483,11 @@ for \\[find-tag] (which see)."
(+ (syntax whitespace)))
(1 'php-import-declaration)
(,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-function-name t)))
;; import constant statement
(,(rx symbol-start (group "use" (+ (syntax whitespace)) "const")
(+ (syntax whitespace)))
(1 'php-import-declaration)
(,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-constant-assign t)))
;; Highlight function calls
("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 'php-function-call)
;; Highlight all upper-cased symbols as constant
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/doc-comment/comments.php.27.faces
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
("\n ")
("const" . php-keyword)
(" ")
("SAMPLE" . font-lock-type-face)
("SAMPLE" . php-constant-assign)
(" ")
("=" . php-assignment-op)
(" ")
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/doc-comment/comments.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
("\n ")
("const" . php-keyword)
(" ")
("SAMPLE" . font-lock-type-face)
("SAMPLE" . php-constant-assign)
(" ")
("=" . php-assignment-op)
(" ")
Expand Down
22 changes: 13 additions & 9 deletions tests/lang/import/import-constant.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
(" ")
("Foo" . font-lock-type-face)
(";\n\n")
("use const" . php-import-declaration)
("use" . php-import-declaration)
(" ")
("Foo\\" . php-constant-assign)
("BAR" . font-lock-type-face)
("const" . php-keyword)
(" ")
("Foo\\BAR" . php-constant-assign)
(";\n")
("use const" . php-import-declaration)
("use" . php-import-declaration)
(" ")
("Foo" . font-lock-type-face)
("\\{BUZ" . php-constant-assign)
("const" . php-keyword)
(" ")
("Foo\\{BUZ" . php-constant-assign)
(", ")
("BUZBUZ}" . php-constant-assign)
(";\n")
("use const" . php-import-declaration)
("use" . php-import-declaration)
(" ")
("const" . php-keyword)
(" ")
("PHP_VERSION" . font-lock-type-face)
("PHP_VERSION" . php-constant-assign)
(";\n\n")
("const" . php-keyword)
(" ")
("FOO" . font-lock-type-face)
("FOO" . php-constant-assign)
(" ")
("=" . php-assignment-op)
(" ")
Expand Down