From unknown Mon Aug 18 09:06:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72796: 30.0.50; [PATCH] php-ts-mode: Improved font locking Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Aug 2024 21:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 72796@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172453574616641 (code B ref -1); Sat, 24 Aug 2024 21:43:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Aug 2024 21:42:26 +0000 Received: from localhost ([127.0.0.1]:41969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shyWg-0004KL-9V for submit@debbugs.gnu.org; Sat, 24 Aug 2024 17:42:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:34414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shyWd-0004KD-Sm for submit@debbugs.gnu.org; Sat, 24 Aug 2024 17:42:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shyVq-0004sO-JJ for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 17:41:34 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shyVo-00009E-Fj for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 17:41:34 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-371b97cfd6fso1857445f8f.2 for ; Sat, 24 Aug 2024 14:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724535690; x=1725140490; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=oxTkFDfJVKh6/rqybpB7U528M2neCTbE+c9PMggUxDk=; b=Rah2KvbW6m+iYjpIqbMMtoEAxyPuZUHwSUXto/7MEO+FTyim5A7oz6wZ+rcectQa/T 2ywGCDawe/zzD56Dusl4D8Ph3tnN8OSrLsqgcNY0SRZXc/E/SGHvLPyjnYB42ioq/nYA fyh7R80Z2zZ55d7B3po10ffPenwAArq4x2U5Al9W+LlXvy/9totQylrKs9064D+2EV9Q I7jkdLUOdIlto7YkboAfz8oThH9qcW1vzzqtcFsgocbfBNNbsRWYx9Cxv7ID8h/rfcra NuOD5qgcAj7mu5p6b0i+TAQ+jl0VsOJCAFFOQotJZ2u+t5xDiBkr7Sij7nqJFhLPoViB y/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724535690; x=1725140490; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oxTkFDfJVKh6/rqybpB7U528M2neCTbE+c9PMggUxDk=; b=vpJWYhWDYF+wTQQspUQgkt7iGqKJMPY1T7Iai0xpeZKlN9wfqNJSQLyYRIkkVaxpyx P71KGXrGUwX1g2RtxokS7iXuOOV6k1z2n94a1vP+YV9dq8vIzoDafhEILZEkwh65qKBm cvMF9Gs1jZGCbETWy7sVwDPDnrfc4p/hvgif+PmwYLAsLMsbxqnwNifOF0YvqqwbbsHg mUtzg8mGGg3kfyOEKXqe9WjV8tFlkCh7mmn6GjSdXZTyJQNU9uj4HYH9/bm4xIei77gb 2FRLWBhTQSPhkwTAC6zJCyy1rnzfo6LmMhBSsd18HDEQVUqaB6gzmpYgXeVsCh2Uk3Gj oZzg== X-Gm-Message-State: AOJu0Yw/vOZsRs4tqEKIMpMVarJjiDN4FQg699D3iBSS1Tg7KHaNUmaT t+1lc4IT/sCT9twItGDbZ+YtDHiFWPjPkEShJbYM1vOZOCz4PdWitdAtDw== X-Google-Smtp-Source: AGHT+IGZu7OHUZd6EdX5tSsKeOavg0BMzzkCQVKPU2Z/tZ02LDmiuyMV891qryldrt0jcRREAPXDJw== X-Received: by 2002:adf:e842:0:b0:368:3f6a:1dec with SMTP id ffacd0b85a97d-373118521dfmr4263025f8f.9.1724535690296; Sat, 24 Aug 2024 14:41:30 -0700 (PDT) Received: from fedora.localnet (93-33-20-28.ip42.fastwebnet.it. [93.33.20.28]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac518038asm106685355e9.45.2024.08.24.14.41.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2024 14:41:29 -0700 (PDT) From: Vincenzo Pupillo Date: Sat, 24 Aug 2024 23:41:28 +0200 Message-ID: <26542402.1r3eYUQgxm@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2277228.vFx2qVVIhK" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=v.pupillo@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --nextPart2277228.vFx2qVVIhK Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Hi, This patch improves font locking, particularly for constants and some operators. It also extends compatibility to the latest version of the PHP parser. The patch can also be applied to version 31.0.50 . Thanks Vincenzo --nextPart2277228.vFx2qVVIhK Content-Disposition: attachment; filename="0001-Improve-php-ts-mode-font-lock-and-support-latest-par.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Improve-php-ts-mode-font-lock-and-support-latest-par.patch" >From 59fd3b34171f5ff17509e8c6c4e73f457ca4d038 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Sat, 24 Aug 2024 23:16:09 +0200 Subject: [PATCH] Improve php-ts-mode font lock and support latest parser release * lisp/progmodes/php-ts-mode.el (php-ts-mode--language-source-alist): Update the parser version. * lisp/progmodes/php-ts-mode.el (php-ts-mode--parent-html-heuristic): Fix commentary. * lisp/progmodes/php-ts-mode.el (php-ts-mode--keywords): Add "exit" keyword. * lisp/progmodes/php-ts-mode.el (php-ts-mode--predefined-constant): Added math constant. * lisp/progmodes/php-ts-mode.el (php-ts-mode--font-lock-settings): New and improved rules. --- lisp/progmodes/php-ts-mode.el | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 89444f0208e..3f89de14075 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -83,7 +83,7 @@ ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist - '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.22.5")) + '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.22.8" "php/src")) (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.20.3")) (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2")) @@ -509,7 +509,7 @@ php-ts-mode--parent-html-heuristic (if (search-forward "" end-html t 1) 0 (+ (point) php-ts-mode-indent-offset)))) - ;; Maybe it's better to use bol, read the documentation!!! + ;; Maybe it's better to use bol? (treesit-node-start parent)))) (defun php-ts-mode--array-element-heuristic (_node parent _bol &rest _) @@ -728,7 +728,7 @@ php-ts-mode--keywords '("abstract" "and" "array" "as" "break" "callable" "case" "catch" "class" "clone" "const" "continue" "declare" "default" "do" "echo" "else" "elseif" "enddeclare" "endfor" "endforeach" "endif" - "endswitch" "endwhile" "enum" "extends" "final" "finally" "fn" + "endswitch" "endwhile" "enum" "exit" "extends" "final" "finally" "fn" "for" "foreach" "from" "function" "global" "goto" "if" "implements" "include" "include_once" "instanceof" "insteadof" "interface" "list" "match" "namespace" "new" "null" "or" "print" "private" @@ -762,6 +762,12 @@ php-ts-mode--predefined-constant "E_COMPILE_WARNING" "E_USER_ERROR" "E_USER_WARNING" "E_USER_NOTICE" "E_DEPRECATED" "E_USER_DEPRECATED" "E_ALL" "E_STRICT" + ;; math constant + "M_PI" "M_E" "M_LOG2E" "M_LOG10E" "M_LN2" "M_LN10" "M_PI_2" + "M_PI_4" "M_1_PI" "M_2_PI" "M_SQRTPI" "M_2_SQRTPI" "M_SQRT2" + "M_SQRT3" "M_SQRT1_2" "M_LNPI" "M_EULER" "PHP_ROUND_HALF_UP" + "PHP_ROUND_HALF_DOWN" "PHP_ROUND_HALF_EVEN" "PHP_ROUND_HALF_ODD" + "NAN" "INF" ;; magic constant "__COMPILER_HALT_OFFSET__" "__CLASS__" "__DIR__" "__FILE__" "__FUNCTION__" "__LINE__" "__METHOD__" "__NAMESPACE__" "__TRAIT__") @@ -785,26 +791,23 @@ php-ts-mode--font-lock-settings :feature 'constant `((boolean) @font-lock-constant-face (null) @font-lock-constant-face - ;; predefined constant or built in constant + ;; predefined constant or built in constant (part of PHP core) ((name) @font-lock-builtin-face (:match ,(rx-to-string `(: bos (or ,@php-ts-mode--predefined-constant) eos)) @font-lock-builtin-face)) ;; user defined constant ((name) @font-lock-constant-face - (:match "\\`_?[A-Z][0-9A-Z_]+\\'" @font-lock-constant-face)) + (:match "\\`_*[A-Z][0-9A-Z_]+\\'" @font-lock-constant-face)) (const_declaration (const_element (name) @font-lock-constant-face)) - (relative_scope "self") @font-lock-builtin-face ;; declare directive (declare_directive ["strict_types" "encoding" "ticks"] @font-lock-constant-face)) :language 'php :feature 'name - `((goto_statement (name) @font-lock-constant-face) - (named_label_statement (name) @font-lock-constant-face) - (expression_statement (name) @font-lock-keyword-face - (:equal "exit" @font-lock-keyword-face))) + '((goto_statement (name) @font-lock-constant-face) + (named_label_statement (name) @font-lock-constant-face)) :language 'php ;;:override t @@ -813,19 +816,21 @@ php-ts-mode--font-lock-settings :language 'php :feature 'operator - `([,@php-ts-mode--operators] @font-lock-operator-face) + `((error_suppression_expression "@" @font-lock-keyword-face) + [,@php-ts-mode--operators] @font-lock-operator-face) :language 'php :feature 'variable-name :override t - `(((name) @font-lock-keyword-face (:equal "this" @font-lock-keyword-face)) + '(((name) @font-lock-keyword-face (:equal "this" @font-lock-keyword-face)) (variable_name (name) @font-lock-variable-name-face) + (relative_scope ["parent" "self" "static"] @font-lock-builtin-face) + (relative_scope) @font-lock-constant-face (dynamic_variable_name (name) @font-lock-variable-name-face) (member_access_expression name: (_) @font-lock-variable-name-face) (scoped_property_access_expression - scope: (name) @font-lock-constant-face) - (error_suppression_expression (name) @font-lock-variable-name-face)) + scope: (name) @font-lock-constant-face)) :language 'php :feature 'string @@ -850,7 +855,8 @@ php-ts-mode--font-lock-settings :language 'php :feature 'type :override t - '((union_type) @font-lock-type-face + '((union_type "|" @font-lock-operator-face) + (union_type) @font-lock-type-face (bottom_type) @font-lock-type-face (primitive_type) @font-lock-type-face (cast_type) @font-lock-type-face @@ -883,17 +889,18 @@ php-ts-mode--font-lock-settings ("=>") @font-lock-keyword-face (object_creation_expression (name) @font-lock-type-face) + (namespace_name_as_prefix "\\" @font-lock-delimiter-face) (namespace_name_as_prefix (namespace_name (name)) @font-lock-type-face) (namespace_use_clause (name) @font-lock-property-use-face) (namespace_aliasing_clause (name) @font-lock-type-face) + (namespace_name "\\" @font-lock-delimiter-face) (namespace_name (name) @font-lock-type-face) (use_declaration (name) @font-lock-property-use-face)) :language 'php :feature 'function-scope :override t - '((relative_scope) @font-lock-constant-face - (scoped_call_expression + '((scoped_call_expression scope: (name) @font-lock-constant-face) (class_constant_access_expression (name) @font-lock-constant-face)) -- 2.46.0 --nextPart2277228.vFx2qVVIhK-- From unknown Mon Aug 18 09:06:23 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Vincenzo Pupillo Subject: bug#72796: closed (Re: bug#72796: 30.0.50; [PATCH] php-ts-mode: Improved font locking) Message-ID: References: <9FFE9897-83A8-4760-8BFA-F1EDC4195D02@gmail.com> <26542402.1r3eYUQgxm@fedora> X-Gnu-PR-Message: they-closed 72796 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 72796@debbugs.gnu.org Date: Mon, 26 Aug 2024 07:55:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1724658901-15712-1" This is a multi-part message in MIME format... ------------=_1724658901-15712-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #72796: 30.0.50; [PATCH] php-ts-mode: Improved font locking which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 72796@debbugs.gnu.org. --=20 72796: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72796 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1724658901-15712-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 72796-done) by debbugs.gnu.org; 26 Aug 2024 07:54:52 +0000 Received: from localhost ([127.0.0.1]:43643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siUYu-00044s-3Z for submit@debbugs.gnu.org; Mon, 26 Aug 2024 03:54:52 -0400 Received: from mail-pf1-f169.google.com ([209.85.210.169]:60528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siUYs-00044c-BQ for 72796-done@debbugs.gnu.org; Mon, 26 Aug 2024 03:54:51 -0400 Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71433cba1b7so2850268b3a.0 for <72796-done@debbugs.gnu.org>; Mon, 26 Aug 2024 00:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724658773; x=1725263573; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=XyLqGzpHWD1ohF3N0zfVy+s8Cgghjxf2WGBQC51l9Ug=; b=VQrVB5+RwKSfbcqqrIW18bl230JOh9Fd8Q5LVmsGLtP8cjOWdWWwip5KrXhI2VVSC6 wjnGv1EKB1hgxyZaovbncD81BuidurIBjS0MY2RT0GFmFKxJ8Hwc2hERnqiNJRXgmMIo JrKuC0ORdYImyRLozMU5JkJQ67r3uz0Uh7AMi06r3jbbErKMZtlULgKkPzVHWJSQJngl jeyYAYjdIxrZkmxWJ42myunRuZiAiPQNIvmOfxJVFFQ1yiFnhvmOn91FDiG1gilozTpl aMxvkZlOFkCf4W04s5qZJzbG6txYJ5ZNZfzcjBgoQnyf3UTj4Ekdwj9NOzvNFrT2cBBh UqOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724658773; x=1725263573; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XyLqGzpHWD1ohF3N0zfVy+s8Cgghjxf2WGBQC51l9Ug=; b=SYrdYV7QrPYqX/qw0HNxJzxG0Mxe/ISsrqbcl6G3eAXGDxW69NTHYFlkr71+e3M8Mp BpgmJ7rfMGRNwE0CIqyoAR9taEZ6KsAKmtYvv2ebpinkGta3V5kdtfRoou+xgcrRfgIw ZNqWAQ1onQH57dho+Ob0Flc+ypYcgAtS+hUApGB8AsgQReJnQjNhIkhHoSpGPAJNSIte Rf0wzmp4JYp27Ux47FWX5Q2fSCYB/0m1Yb9EQuXvN2hKTUVPyDrE3TV2tm0yma5tjX5v gY2/3oIfJfUNifuOs6QK75NXezIMimUa/5o4wV5ZwBmydZ3L75M9PBQTAHfuiW0mfA2P Ojag== X-Gm-Message-State: AOJu0YzgusHCmkAAgucp+alM/BAEUTX4NBZ0e5+sdpBuDKzY7n9AdY+m YUJNKOl4AXd/UkT7+RQWr4zCQDkm+aQqhXmbaxr/3E5wX2IqH75K X-Google-Smtp-Source: AGHT+IGQzZfW6APQrlB2gg1EGiNUsqO9jsiPMf/Nrm7YnUBNw5Q4P4S6Se4KmBXbmfCkUnRHBvufFg== X-Received: by 2002:a05:6a21:4581:b0:1c8:9749:a4c1 with SMTP id adf61e73a8af0-1cc8a084f1dmr8637581637.49.1724658773048; Mon, 26 Aug 2024 00:52:53 -0700 (PDT) Received: from smtpclient.apple ([2601:646:8f81:6120:3470:5bab:363c:9aa2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2038557e895sm62960485ad.71.2024.08.26.00.52.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2024 00:52:52 -0700 (PDT) From: Yuan Fu Message-Id: <9FFE9897-83A8-4760-8BFA-F1EDC4195D02@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_920B0036-609D-482D-882B-85E04419B71B" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: bug#72796: 30.0.50; [PATCH] php-ts-mode: Improved font locking Date: Mon, 26 Aug 2024 00:52:41 -0700 In-Reply-To: <26542402.1r3eYUQgxm@fedora> To: Vincenzo Pupillo References: <26542402.1r3eYUQgxm@fedora> X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72796-done Cc: 72796-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_920B0036-609D-482D-882B-85E04419B71B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 24, 2024, at 2:41=E2=80=AFPM, Vincenzo Pupillo = wrote: >=20 > Hi,=20 > This patch improves font locking, particularly for constants and some=20= > operators. It also extends compatibility to the latest version of the = PHP=20 > parser. > The patch can also be applied to version 31.0.50 . >=20 > Thanks > Vincenzo= --Apple-Mail=_920B0036-609D-482D-882B-85E04419B71B Content-Disposition: attachment; filename=0001-Improve-php-ts-mode-font-lock-and-support-latest-par.patch Content-Type: text/x-patch; x-unix-mode=0644; name="0001-Improve-php-ts-mode-font-lock-and-support-latest-par.patch" Content-Transfer-Encoding: quoted-printable =46rom 59fd3b34171f5ff17509e8c6c4e73f457ca4d038 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Sat, 24 Aug 2024 23:16:09 +0200 Subject: [PATCH] Improve php-ts-mode font lock and support latest parser release * lisp/progmodes/php-ts-mode.el (php-ts-mode--language-source-alist): Update the parser version. * lisp/progmodes/php-ts-mode.el (php-ts-mode--parent-html-heuristic): Fix commentary. * lisp/progmodes/php-ts-mode.el (php-ts-mode--keywords): Add "exit" keyword. * lisp/progmodes/php-ts-mode.el (php-ts-mode--predefined-constant): Added math constant. * lisp/progmodes/php-ts-mode.el (php-ts-mode--font-lock-settings): New and improved rules. --- lisp/progmodes/php-ts-mode.el | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el = b/lisp/progmodes/php-ts-mode.el index 89444f0208e..3f89de14075 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -83,7 +83,7 @@ =20 ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist - '((php . ("https://github.com/tree-sitter/tree-sitter-php" = "v0.22.5")) + '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.22.8" = "php/src")) (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) (html . ("https://github.com/tree-sitter/tree-sitter-html" = "v0.20.3")) (javascript . = ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2")) @@ -509,7 +509,7 @@ php-ts-mode--parent-html-heuristic (if (search-forward "" end-html t 1) 0 (+ (point) php-ts-mode-indent-offset)))) - ;; Maybe it's better to use bol, read the documentation!!! + ;; Maybe it's better to use bol? (treesit-node-start parent)))) =20 (defun php-ts-mode--array-element-heuristic (_node parent _bol &rest _) @@ -728,7 +728,7 @@ php-ts-mode--keywords '("abstract" "and" "array" "as" "break" "callable" "case" "catch" "class" "clone" "const" "continue" "declare" "default" "do" "echo" "else" "elseif" "enddeclare" "endfor" "endforeach" "endif" - "endswitch" "endwhile" "enum" "extends" "final" "finally" "fn" + "endswitch" "endwhile" "enum" "exit" "extends" "final" "finally" = "fn" "for" "foreach" "from" "function" "global" "goto" "if" "implements" "include" "include_once" "instanceof" "insteadof" "interface" "list" "match" "namespace" "new" "null" "or" "print" "private" @@ -762,6 +762,12 @@ php-ts-mode--predefined-constant "E_COMPILE_WARNING" "E_USER_ERROR" "E_USER_WARNING" "E_USER_NOTICE" "E_DEPRECATED" "E_USER_DEPRECATED" "E_ALL" "E_STRICT" + ;; math constant + "M_PI" "M_E" "M_LOG2E" "M_LOG10E" "M_LN2" "M_LN10" "M_PI_2" + "M_PI_4" "M_1_PI" "M_2_PI" "M_SQRTPI" "M_2_SQRTPI" "M_SQRT2" + "M_SQRT3" "M_SQRT1_2" "M_LNPI" "M_EULER" "PHP_ROUND_HALF_UP" + "PHP_ROUND_HALF_DOWN" "PHP_ROUND_HALF_EVEN" "PHP_ROUND_HALF_ODD" + "NAN" "INF" ;; magic constant "__COMPILER_HALT_OFFSET__" "__CLASS__" "__DIR__" "__FILE__" "__FUNCTION__" "__LINE__" "__METHOD__" "__NAMESPACE__" "__TRAIT__") @@ -785,26 +791,23 @@ php-ts-mode--font-lock-settings :feature 'constant `((boolean) @font-lock-constant-face (null) @font-lock-constant-face - ;; predefined constant or built in constant + ;; predefined constant or built in constant (part of PHP core) ((name) @font-lock-builtin-face (:match ,(rx-to-string `(: bos (or ,@php-ts-mode--predefined-constant) eos)) @font-lock-builtin-face)) ;; user defined constant ((name) @font-lock-constant-face - (:match "\\`_?[A-Z][0-9A-Z_]+\\'" @font-lock-constant-face)) + (:match "\\`_*[A-Z][0-9A-Z_]+\\'" @font-lock-constant-face)) (const_declaration (const_element (name) @font-lock-constant-face)) - (relative_scope "self") @font-lock-builtin-face ;; declare directive (declare_directive ["strict_types" "encoding" "ticks"] = @font-lock-constant-face)) =20 :language 'php :feature 'name - `((goto_statement (name) @font-lock-constant-face) - (named_label_statement (name) @font-lock-constant-face) - (expression_statement (name) @font-lock-keyword-face - (:equal "exit" @font-lock-keyword-face))) + '((goto_statement (name) @font-lock-constant-face) + (named_label_statement (name) @font-lock-constant-face)) =20 :language 'php ;;:override t @@ -813,19 +816,21 @@ php-ts-mode--font-lock-settings =20 :language 'php :feature 'operator - `([,@php-ts-mode--operators] @font-lock-operator-face) + `((error_suppression_expression "@" @font-lock-keyword-face) + [,@php-ts-mode--operators] @font-lock-operator-face) =20 :language 'php :feature 'variable-name :override t - `(((name) @font-lock-keyword-face (:equal "this" = @font-lock-keyword-face)) + '(((name) @font-lock-keyword-face (:equal "this" = @font-lock-keyword-face)) (variable_name (name) @font-lock-variable-name-face) + (relative_scope ["parent" "self" "static"] = @font-lock-builtin-face) + (relative_scope) @font-lock-constant-face (dynamic_variable_name (name) @font-lock-variable-name-face) (member_access_expression name: (_) @font-lock-variable-name-face) (scoped_property_access_expression - scope: (name) @font-lock-constant-face) - (error_suppression_expression (name) = @font-lock-variable-name-face)) + scope: (name) @font-lock-constant-face)) =20 :language 'php :feature 'string @@ -850,7 +855,8 @@ php-ts-mode--font-lock-settings :language 'php :feature 'type :override t - '((union_type) @font-lock-type-face + '((union_type "|" @font-lock-operator-face) + (union_type) @font-lock-type-face (bottom_type) @font-lock-type-face (primitive_type) @font-lock-type-face (cast_type) @font-lock-type-face @@ -883,17 +889,18 @@ php-ts-mode--font-lock-settings ("=3D>") @font-lock-keyword-face (object_creation_expression (name) @font-lock-type-face) + (namespace_name_as_prefix "\\" @font-lock-delimiter-face) (namespace_name_as_prefix (namespace_name (name)) = @font-lock-type-face) (namespace_use_clause (name) @font-lock-property-use-face) (namespace_aliasing_clause (name) @font-lock-type-face) + (namespace_name "\\" @font-lock-delimiter-face) (namespace_name (name) @font-lock-type-face) (use_declaration (name) @font-lock-property-use-face)) =20 :language 'php :feature 'function-scope :override t - '((relative_scope) @font-lock-constant-face - (scoped_call_expression + '((scoped_call_expression scope: (name) @font-lock-constant-face) (class_constant_access_expression (name) = @font-lock-constant-face)) =20 --=20 2.46.0 --Apple-Mail=_920B0036-609D-482D-882B-85E04419B71B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thanks Vince! I merged your patch to emacs-30. BTW, in the future it=E2=80= =99s probably better to make the code work for both old and new grammar = versions (whenever you can), that way people who installed the old = grammar from who-knows-where can still use the mode. (I=E2=80=99m = working on some tool to make it simpler to define alternative font-lock = rules that works on multiple grammar versions.) Yuan= --Apple-Mail=_920B0036-609D-482D-882B-85E04419B71B-- ------------=_1724658901-15712-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Aug 2024 21:42:26 +0000 Received: from localhost ([127.0.0.1]:41969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shyWg-0004KL-9V for submit@debbugs.gnu.org; Sat, 24 Aug 2024 17:42:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:34414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shyWd-0004KD-Sm for submit@debbugs.gnu.org; Sat, 24 Aug 2024 17:42:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shyVq-0004sO-JJ for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 17:41:34 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shyVo-00009E-Fj for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 17:41:34 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-371b97cfd6fso1857445f8f.2 for ; Sat, 24 Aug 2024 14:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724535690; x=1725140490; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=oxTkFDfJVKh6/rqybpB7U528M2neCTbE+c9PMggUxDk=; b=Rah2KvbW6m+iYjpIqbMMtoEAxyPuZUHwSUXto/7MEO+FTyim5A7oz6wZ+rcectQa/T 2ywGCDawe/zzD56Dusl4D8Ph3tnN8OSrLsqgcNY0SRZXc/E/SGHvLPyjnYB42ioq/nYA fyh7R80Z2zZ55d7B3po10ffPenwAArq4x2U5Al9W+LlXvy/9totQylrKs9064D+2EV9Q I7jkdLUOdIlto7YkboAfz8oThH9qcW1vzzqtcFsgocbfBNNbsRWYx9Cxv7ID8h/rfcra NuOD5qgcAj7mu5p6b0i+TAQ+jl0VsOJCAFFOQotJZ2u+t5xDiBkr7Sij7nqJFhLPoViB y/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724535690; x=1725140490; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oxTkFDfJVKh6/rqybpB7U528M2neCTbE+c9PMggUxDk=; b=vpJWYhWDYF+wTQQspUQgkt7iGqKJMPY1T7Iai0xpeZKlN9wfqNJSQLyYRIkkVaxpyx P71KGXrGUwX1g2RtxokS7iXuOOV6k1z2n94a1vP+YV9dq8vIzoDafhEILZEkwh65qKBm cvMF9Gs1jZGCbETWy7sVwDPDnrfc4p/hvgif+PmwYLAsLMsbxqnwNifOF0YvqqwbbsHg mUtzg8mGGg3kfyOEKXqe9WjV8tFlkCh7mmn6GjSdXZTyJQNU9uj4HYH9/bm4xIei77gb 2FRLWBhTQSPhkwTAC6zJCyy1rnzfo6LmMhBSsd18HDEQVUqaB6gzmpYgXeVsCh2Uk3Gj oZzg== X-Gm-Message-State: AOJu0Yw/vOZsRs4tqEKIMpMVarJjiDN4FQg699D3iBSS1Tg7KHaNUmaT t+1lc4IT/sCT9twItGDbZ+YtDHiFWPjPkEShJbYM1vOZOCz4PdWitdAtDw== X-Google-Smtp-Source: AGHT+IGZu7OHUZd6EdX5tSsKeOavg0BMzzkCQVKPU2Z/tZ02LDmiuyMV891qryldrt0jcRREAPXDJw== X-Received: by 2002:adf:e842:0:b0:368:3f6a:1dec with SMTP id ffacd0b85a97d-373118521dfmr4263025f8f.9.1724535690296; Sat, 24 Aug 2024 14:41:30 -0700 (PDT) Received: from fedora.localnet (93-33-20-28.ip42.fastwebnet.it. [93.33.20.28]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac518038asm106685355e9.45.2024.08.24.14.41.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2024 14:41:29 -0700 (PDT) From: Vincenzo Pupillo To: bug-gnu-emacs@gnu.org Subject: 30.0.50; [PATCH] php-ts-mode: Improved font locking Date: Sat, 24 Aug 2024 23:41:28 +0200 Message-ID: <26542402.1r3eYUQgxm@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2277228.vFx2qVVIhK" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=v.pupillo@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --nextPart2277228.vFx2qVVIhK Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Hi, This patch improves font locking, particularly for constants and some operators. It also extends compatibility to the latest version of the PHP parser. The patch can also be applied to version 31.0.50 . Thanks Vincenzo --nextPart2277228.vFx2qVVIhK Content-Disposition: attachment; filename="0001-Improve-php-ts-mode-font-lock-and-support-latest-par.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Improve-php-ts-mode-font-lock-and-support-latest-par.patch" >From 59fd3b34171f5ff17509e8c6c4e73f457ca4d038 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Sat, 24 Aug 2024 23:16:09 +0200 Subject: [PATCH] Improve php-ts-mode font lock and support latest parser release * lisp/progmodes/php-ts-mode.el (php-ts-mode--language-source-alist): Update the parser version. * lisp/progmodes/php-ts-mode.el (php-ts-mode--parent-html-heuristic): Fix commentary. * lisp/progmodes/php-ts-mode.el (php-ts-mode--keywords): Add "exit" keyword. * lisp/progmodes/php-ts-mode.el (php-ts-mode--predefined-constant): Added math constant. * lisp/progmodes/php-ts-mode.el (php-ts-mode--font-lock-settings): New and improved rules. --- lisp/progmodes/php-ts-mode.el | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 89444f0208e..3f89de14075 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -83,7 +83,7 @@ ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist - '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.22.5")) + '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.22.8" "php/src")) (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.20.3")) (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2")) @@ -509,7 +509,7 @@ php-ts-mode--parent-html-heuristic (if (search-forward "" end-html t 1) 0 (+ (point) php-ts-mode-indent-offset)))) - ;; Maybe it's better to use bol, read the documentation!!! + ;; Maybe it's better to use bol? (treesit-node-start parent)))) (defun php-ts-mode--array-element-heuristic (_node parent _bol &rest _) @@ -728,7 +728,7 @@ php-ts-mode--keywords '("abstract" "and" "array" "as" "break" "callable" "case" "catch" "class" "clone" "const" "continue" "declare" "default" "do" "echo" "else" "elseif" "enddeclare" "endfor" "endforeach" "endif" - "endswitch" "endwhile" "enum" "extends" "final" "finally" "fn" + "endswitch" "endwhile" "enum" "exit" "extends" "final" "finally" "fn" "for" "foreach" "from" "function" "global" "goto" "if" "implements" "include" "include_once" "instanceof" "insteadof" "interface" "list" "match" "namespace" "new" "null" "or" "print" "private" @@ -762,6 +762,12 @@ php-ts-mode--predefined-constant "E_COMPILE_WARNING" "E_USER_ERROR" "E_USER_WARNING" "E_USER_NOTICE" "E_DEPRECATED" "E_USER_DEPRECATED" "E_ALL" "E_STRICT" + ;; math constant + "M_PI" "M_E" "M_LOG2E" "M_LOG10E" "M_LN2" "M_LN10" "M_PI_2" + "M_PI_4" "M_1_PI" "M_2_PI" "M_SQRTPI" "M_2_SQRTPI" "M_SQRT2" + "M_SQRT3" "M_SQRT1_2" "M_LNPI" "M_EULER" "PHP_ROUND_HALF_UP" + "PHP_ROUND_HALF_DOWN" "PHP_ROUND_HALF_EVEN" "PHP_ROUND_HALF_ODD" + "NAN" "INF" ;; magic constant "__COMPILER_HALT_OFFSET__" "__CLASS__" "__DIR__" "__FILE__" "__FUNCTION__" "__LINE__" "__METHOD__" "__NAMESPACE__" "__TRAIT__") @@ -785,26 +791,23 @@ php-ts-mode--font-lock-settings :feature 'constant `((boolean) @font-lock-constant-face (null) @font-lock-constant-face - ;; predefined constant or built in constant + ;; predefined constant or built in constant (part of PHP core) ((name) @font-lock-builtin-face (:match ,(rx-to-string `(: bos (or ,@php-ts-mode--predefined-constant) eos)) @font-lock-builtin-face)) ;; user defined constant ((name) @font-lock-constant-face - (:match "\\`_?[A-Z][0-9A-Z_]+\\'" @font-lock-constant-face)) + (:match "\\`_*[A-Z][0-9A-Z_]+\\'" @font-lock-constant-face)) (const_declaration (const_element (name) @font-lock-constant-face)) - (relative_scope "self") @font-lock-builtin-face ;; declare directive (declare_directive ["strict_types" "encoding" "ticks"] @font-lock-constant-face)) :language 'php :feature 'name - `((goto_statement (name) @font-lock-constant-face) - (named_label_statement (name) @font-lock-constant-face) - (expression_statement (name) @font-lock-keyword-face - (:equal "exit" @font-lock-keyword-face))) + '((goto_statement (name) @font-lock-constant-face) + (named_label_statement (name) @font-lock-constant-face)) :language 'php ;;:override t @@ -813,19 +816,21 @@ php-ts-mode--font-lock-settings :language 'php :feature 'operator - `([,@php-ts-mode--operators] @font-lock-operator-face) + `((error_suppression_expression "@" @font-lock-keyword-face) + [,@php-ts-mode--operators] @font-lock-operator-face) :language 'php :feature 'variable-name :override t - `(((name) @font-lock-keyword-face (:equal "this" @font-lock-keyword-face)) + '(((name) @font-lock-keyword-face (:equal "this" @font-lock-keyword-face)) (variable_name (name) @font-lock-variable-name-face) + (relative_scope ["parent" "self" "static"] @font-lock-builtin-face) + (relative_scope) @font-lock-constant-face (dynamic_variable_name (name) @font-lock-variable-name-face) (member_access_expression name: (_) @font-lock-variable-name-face) (scoped_property_access_expression - scope: (name) @font-lock-constant-face) - (error_suppression_expression (name) @font-lock-variable-name-face)) + scope: (name) @font-lock-constant-face)) :language 'php :feature 'string @@ -850,7 +855,8 @@ php-ts-mode--font-lock-settings :language 'php :feature 'type :override t - '((union_type) @font-lock-type-face + '((union_type "|" @font-lock-operator-face) + (union_type) @font-lock-type-face (bottom_type) @font-lock-type-face (primitive_type) @font-lock-type-face (cast_type) @font-lock-type-face @@ -883,17 +889,18 @@ php-ts-mode--font-lock-settings ("=>") @font-lock-keyword-face (object_creation_expression (name) @font-lock-type-face) + (namespace_name_as_prefix "\\" @font-lock-delimiter-face) (namespace_name_as_prefix (namespace_name (name)) @font-lock-type-face) (namespace_use_clause (name) @font-lock-property-use-face) (namespace_aliasing_clause (name) @font-lock-type-face) + (namespace_name "\\" @font-lock-delimiter-face) (namespace_name (name) @font-lock-type-face) (use_declaration (name) @font-lock-property-use-face)) :language 'php :feature 'function-scope :override t - '((relative_scope) @font-lock-constant-face - (scoped_call_expression + '((scoped_call_expression scope: (name) @font-lock-constant-face) (class_constant_access_expression (name) @font-lock-constant-face)) -- 2.46.0 --nextPart2277228.vFx2qVVIhK-- ------------=_1724658901-15712-1-- From unknown Mon Aug 18 09:06:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72796: 30.0.50; [PATCH] php-ts-mode: Improved font locking Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Aug 2024 10:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Yuan Fu Cc: 72796-done@debbugs.gnu.org Received: via spool by 72796-done@debbugs.gnu.org id=D72796.172466753831213 (code D ref 72796); Mon, 26 Aug 2024 10:19:01 +0000 Received: (at 72796-done) by debbugs.gnu.org; 26 Aug 2024 10:18:58 +0000 Received: from localhost ([127.0.0.1]:43760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siWoM-00087N-4V for submit@debbugs.gnu.org; Mon, 26 Aug 2024 06:18:58 -0400 Received: from mail-io1-f41.google.com ([209.85.166.41]:44107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siWoK-000878-5x for 72796-done@debbugs.gnu.org; Mon, 26 Aug 2024 06:18:56 -0400 Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-829e3fbcb87so19248439f.0 for <72796-done@debbugs.gnu.org>; Mon, 26 Aug 2024 03:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724667419; x=1725272219; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Khx6V6Nkpk4egqLGKn9OR85lE++igpC63cvmGg2denM=; b=U+OCYSbqhWLLP607FZAlY0AqpD0NfIYnPewRm25vpP7hCLAoZxBJ12+aa+alACqN95 tPc5gDR1a8jHhoPgvZjDFX3WznjXeh/8PErSuXXS7r3gbjvetqF/RhZQPm7PniuveDCe RsAT2AaQTzLM527io8TyclGRPDDo//O5ny+aH3mrgeRCRGbsfJ6BzLjfZN4zoBzhfvQJ rgAUKWgPJCecF7DXYBVFnyyOdStYZNLU3tJ7WO7PbSJuJlV6MNuo3oe5pCqepXteaLcy j7Vh/cULymo5zJESyR4Z2duSWIYAdAkCms6kUXJDWdl2SxLN437rKXHDmWzt6gk+Noac QSXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724667419; x=1725272219; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Khx6V6Nkpk4egqLGKn9OR85lE++igpC63cvmGg2denM=; b=qBvLKZTW2zHMLlo4u6mPn0P0EY3bBPKIAt5uAzpkSLlSWNnAlgmTiljNLUmrKKbDhz Ysy/IKfFk6hntwVse1/yZy7re+skq9dPZ6ppXzeZIi1pnXiCnxROcKyVdkLuSIGO4t4U 9icKmUrliF3YzuYoCRkyDfs9qiKTJEYiEUxXF+//f0G04n+GmBOxMwmsSeUX0xhfsFZd a5uYWJouz3WkGL5QqR+rE4jyA59DYiGnuE3pw3dZVoLc4uFid1L2RYKrwwixVjLrdAwh SJ1vJAdHaUBeYs2QphiNtzjWH85kMpNu6cC7JkMCLpvIqnL6E/Rp+b9VZqkgKVRW9mAv 4oRg== X-Gm-Message-State: AOJu0YzXeZjEHD3Cddv1U8OKVal9Y2YPNlgByn5SoQFrcxePF7gKmun4 VcLWHqOa9ox8TLjQcllyBtSEpEvNeOg9zw0juam87IKy+CtVKLat3fqo1tzc4U5VCvb+owPpoM0 tSwe2V5L+AIWUvPwiY8Q+7ByQpm4= X-Google-Smtp-Source: AGHT+IGDddl3hoChIgaCc6cUeZhHn9R5LJbZotPaHxssa4upSKYS9sdQqNPyPjnuXx0oOGm+VNEGinUlS/Sh02vbm3Y= X-Received: by 2002:a05:6602:2b82:b0:807:aebc:3bdd with SMTP id ca18e2360f4ac-8278731c4b8mr1415367239f.5.1724667419054; Mon, 26 Aug 2024 03:16:59 -0700 (PDT) MIME-Version: 1.0 References: <26542402.1r3eYUQgxm@fedora> <9FFE9897-83A8-4760-8BFA-F1EDC4195D02@gmail.com> In-Reply-To: <9FFE9897-83A8-4760-8BFA-F1EDC4195D02@gmail.com> From: Vincenzo Pupillo Date: Mon, 26 Aug 2024 12:16:23 +0200 Message-ID: Content-Type: multipart/alternative; boundary="000000000000de5de10620936cbb" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000de5de10620936cbb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Yuan. I also tested the patch with the previous version of Grammar (v0.22.5) and found no problems. Did you experience any problems? Since php-ts-mode is not available in emacs-29 and emacs-30 has not been released, perhaps it is better to support grammars from the release date. Or is it better to support from the date of the first merge? I have no idea which is the best policy. Thanks. Vincenzo Il giorno lun 26 ago 2024 alle ore 09:52 Yuan Fu ha scritto: > > > > On Aug 24, 2024, at 2:41=E2=80=AFPM, Vincenzo Pupillo > wrote: > > > > Hi, > > This patch improves font locking, particularly for constants and some > > operators. It also extends compatibility to the latest version of the > PHP > > parser. > > The patch can also be applied to version 31.0.50 . > > > > Thanks > > Vincenzo > Thanks Vince! I merged your patch to emacs-30. BTW, in the future it=E2= =80=99s > probably better to make the code work for both old and new grammar versio= ns > (whenever you can), that way people who installed the old grammar from > who-knows-where can still use the mode. (I=E2=80=99m working on some tool= to make > it simpler to define alternative font-lock rules that works on multiple > grammar versions.) > > Yuan --000000000000de5de10620936cbb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Yuan.
I also tested the patch with t= he previous version of Grammar (v0.22.5) and found no problems. Did you exp= erience any problems?
Since php-ts-mode is not available in emacs= -29 and emacs-30 has not been released, perhaps it is better to support gra= mmars from the release date. Or is it better to support from the date of th= e first merge?=C2=A0 I have no idea which is the best policy.
Tha= nks.
Vincenzo

Il giorno lun 26 ago 2024 alle ore 09:52 Yuan Fu= <casouri@gmail.com> ha scri= tto:


> On Aug 24, 2024, at 2:41=E2=80=AFPM, Vincenzo Pupillo <v.pupillo@gmail.com> wr= ote:
>
> Hi,
> This patch improves font locking, particularly for constants and some =
> operators. It also extends compatibility to the latest version of the = PHP
> parser.
> The patch can also be applied to version 31.0.50 .
>
> Thanks
> Vincenzo
Thanks Vince! I merged your patch to emacs-30. BTW, in the future it=E2=80= =99s probably better to make the code work for both old and new grammar ver= sions (whenever you can), that way people who installed the old grammar fro= m who-knows-where can still use the mode. (I=E2=80=99m working on some tool= to make it simpler to define alternative font-lock rules that works on mul= tiple grammar versions.)

Yuan
--000000000000de5de10620936cbb-- From unknown Mon Aug 18 09:06:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72796: 30.0.50; [PATCH] php-ts-mode: Improved font locking Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Aug 2024 11:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Vincenzo Pupillo Cc: casouri@gmail.com, 72796@debbugs.gnu.org Received: via spool by 72796-submit@debbugs.gnu.org id=B72796.17246720187393 (code B ref 72796); Mon, 26 Aug 2024 11:34:02 +0000 Received: (at 72796) by debbugs.gnu.org; 26 Aug 2024 11:33:38 +0000 Received: from localhost ([127.0.0.1]:43820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siXyc-0001vB-Ay for submit@debbugs.gnu.org; Mon, 26 Aug 2024 07:33:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siXya-0001uv-H4 for 72796@debbugs.gnu.org; Mon, 26 Aug 2024 07:33:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siXxe-00052z-LO; Mon, 26 Aug 2024 07:32:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=D1iNXTDYng/+4vZw/9WMuQaR191Tb+sjbP/510f/t4w=; b=D/CtBTPLWw0H M+61JSi7kgmzfBke7D9sb8eSg0KluM59XYcA1zw88YqSul2TzcGlx0OiC83lpH9GrCnT+AYFkHWTv z4OGB1cINWyrMxX6cvJqD1fGALL5TwFA0YE2RthkwN0mYiJO3Df7o+qrcRXh+TroTG1p2fLYWiNWe W/YBngPgtj4OQgKhBpX03xQX+tiOhQK7/Xn5cjL3kTSyPAinsbT2wznZzZ9HO6x1eFRMcBbxh6ul6 Vx1MLLdWJwo9UklrnC/lyoj2Ng4TYYIfSVHPXQas/TdotNEcp5eIa+W5k07J3jL8Yl+z2Z8R6sr4E pyk6/94dFEMk1rgq9YdJ6g==; Date: Mon, 26 Aug 2024 14:32:35 +0300 Message-Id: <86ikvnjz8s.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Vincenzo Pupillo on Mon, 26 Aug 2024 12:16:23 +0200) References: <26542402.1r3eYUQgxm@fedora> <9FFE9897-83A8-4760-8BFA-F1EDC4195D02@gmail.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 72796-done@debbugs.gnu.org > From: Vincenzo Pupillo > Date: Mon, 26 Aug 2024 12:16:23 +0200 > > Since php-ts-mode is not available in emacs-29 and emacs-30 has not been released, perhaps it is better to > support grammars from the release date. Or is it better to support from the date of the first merge? I have no > idea which is the best policy. We cannot be sure that users of this mode will necessarily have the latest grammar library. It depends on various factors, like the installation policies on the user's system. So I think it's best to be tolerant to the version of the grammar, if this is feasible.