[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/php-mode 30c331b923 1/2: Fix "use const" font-lock
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/php-mode 30c331b923 1/2: Fix "use const" font-lock |
Date: |
Sun, 12 Feb 2023 02:59:26 -0500 (EST) |
branch: elpa/php-mode
commit 30c331b9237da6cec963722952ddbf64bcf349e4
Author: USAMI Kenta <tadsan@zonu.me>
Commit: USAMI Kenta <tadsan@zonu.me>
Fix "use const" font-lock
---
lisp/php-face.el | 2 +-
lisp/php-mode.el | 14 +++++++-------
tests/lang/doc-comment/comments.php.27.faces | 2 +-
tests/lang/doc-comment/comments.php.faces | 2 +-
tests/lang/import/import-constant.php.faces | 22 +++++++++++++---------
5 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/lisp/php-face.el b/lisp/php-face.el
index 6fade2409d..1106035c9a 100644
--- a/lisp/php-face.el
+++ b/lisp/php-face.el
@@ -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")
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 407745b3c3..319e1d2a4b 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -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."
@@ -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)
@@ -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
diff --git a/tests/lang/doc-comment/comments.php.27.faces
b/tests/lang/doc-comment/comments.php.27.faces
index b659a0ab42..8b3b78e576 100644
--- a/tests/lang/doc-comment/comments.php.27.faces
+++ b/tests/lang/doc-comment/comments.php.27.faces
@@ -71,7 +71,7 @@
("\n ")
("const" . php-keyword)
(" ")
- ("SAMPLE" . font-lock-type-face)
+ ("SAMPLE" . php-constant-assign)
(" ")
("=" . php-assignment-op)
(" ")
diff --git a/tests/lang/doc-comment/comments.php.faces
b/tests/lang/doc-comment/comments.php.faces
index c849191177..593bb49e37 100644
--- a/tests/lang/doc-comment/comments.php.faces
+++ b/tests/lang/doc-comment/comments.php.faces
@@ -70,7 +70,7 @@
("\n ")
("const" . php-keyword)
(" ")
- ("SAMPLE" . font-lock-type-face)
+ ("SAMPLE" . php-constant-assign)
(" ")
("=" . php-assignment-op)
(" ")
diff --git a/tests/lang/import/import-constant.php.faces
b/tests/lang/import/import-constant.php.faces
index bef6797ee3..015e7494d2 100644
--- a/tests/lang/import/import-constant.php.faces
+++ b/tests/lang/import/import-constant.php.faces
@@ -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)
(" ")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/php-mode 30c331b923 1/2: Fix "use const" font-lock,
ELPA Syncer <=