From unknown Mon Aug 18 11:07:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59629: Highlighting Python operators Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2022 11:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59629 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 59629@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16695489625431 (code B ref -1); Sun, 27 Nov 2022 11:37:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Nov 2022 11:36:02 +0000 Received: from localhost ([127.0.0.1]:42200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozFx4-0001PL-1K for submit@debbugs.gnu.org; Sun, 27 Nov 2022 06:36:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:60814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozFwx-0001PB-De for submit@debbugs.gnu.org; Sun, 27 Nov 2022 06:36:00 -0500 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 1ozFww-0005wn-OG for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 06:35:54 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozFwt-00026D-PR for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 06:35:53 -0500 Received: by mail-pl1-x636.google.com with SMTP id 4so7735034pli.0 for ; Sun, 27 Nov 2022 03:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:subject:to:from:message-id:date:from:to:cc :subject:date:message-id:reply-to; bh=4cWw0bb7gnrKw7bI1iHQ2DGG6b05VFQ5/2wQvlmVvAg=; b=Q/R3TLuSK3nnVne1m9sJx2PqJhuslry55wXvcz+VKDmSB26rdjULeUK550YbBJhvXO 5KVtEmCwUK0gzuNYWC4EDrUaUpdENNlueG4gjGJDWyKs68s2lskzJRkGZtGxYXddA29B k+xL7IhYuZtRWnM8bhQ0LADKGsXjA9z7YS+eAGdOCwKjAxwiykA89bUuMymganHnRW4I 9mxfGXgz3K5vi5+0DmpokwIDcJ4cE7pRUOne+w/bM+wHsQpg2ItFgfiva9gLcCxH/krP Fl7g6vpZtf/WTg9bSDnT6LTzqCBh2z9GyupP7TMxw+wzLptYW/N9H5xfK61cBPg2fxGG mCrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:subject:to:from:message-id:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4cWw0bb7gnrKw7bI1iHQ2DGG6b05VFQ5/2wQvlmVvAg=; b=1mL0/G8fLL62KJjuy1MWFhPc0sIX4KQXHdapeOK80TMZ2kF7Q0DOqum9dvO6BPTBEN P19m7INwDTwmdbWz7fQdn9GXssa+409Cd3PdddpSZ5RHDTuKa3ZeawBzVL61nK+nrdaP STfXfu3E0n0+PD6toP9NVdU3y1zQNKBzO8SNoXNzpHx9IAu51y4NwlDxrV+f7hP2CGZI 1PuPqoKx0mXieBOLCnSL6XXUUGJ3UJpdTMT6W81oGhkhbehYwTPkMHsmcSkR9Q68bS/b BSgAjCCbvDjxZDeAo9MSna/bQwR+oyTq2ckk5t7x+ZpMdUy5SRnGk5wTB/E/hdlMiZ5q BkZw== X-Gm-Message-State: ANoB5pkxZS0iCdVuma2gyIR+0cpE0oIyc1Bx++pIUcDFboATDqcv9hZ0 T1jGWLoGn/9kST20dwM09mJJrqq4nLw= X-Google-Smtp-Source: AA0mqf4xcvw10I3VFCwMR2NzfYdIBancBZv80MkPXWLR28fLl5FKYj3tCfgD/mVfjGY2t7uv57CyrQ== X-Received: by 2002:a17:902:bc86:b0:189:1916:9bd4 with SMTP id bb6-20020a170902bc8600b0018919169bd4mr35696279plb.49.1669548949031; Sun, 27 Nov 2022 03:35:49 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id l9-20020a63f309000000b0046feca0883fsm4989151pgh.64.2022.11.27.03.35.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 03:35:47 -0800 (PST) Date: Sun, 27 Nov 2022 20:35:28 +0900 Message-ID: From: kobarity User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sun_Nov_27_20:35:28_2022-1" Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=kobarity@gmail.com; helo=mail-pl1-x636.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 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 (--) --Multipart_Sun_Nov_27_20:35:28_2022-1 Content-Type: text/plain; charset=US-ASCII Hello, Now that font-lock-operator-face is defined, it might be useful to highlight Python operators (without treesit). Attached is a patch to highlight Python operators. Best Regards, --Multipart_Sun_Nov_27_20:35:28_2022-1 Content-Type: application/octet-stream; type=patch; name="0001-Add-highlighting-Python-operators.patch" Content-Disposition: attachment; filename="0001-Add-highlighting-Python-operators.patch" Content-Transfer-Encoding: 7bit >From 5d3a5e4179616c9d08def5ef36738d25b0f94e40 Mon Sep 17 00:00:00 2001 From: kobarity Date: Sun, 27 Nov 2022 18:52:32 +0900 Subject: [PATCH] Add highlighting Python operators * lisp/progmodes/python.el (python-rx): Remove "is" and "not" from operator. (python-font-lock-keywords-maximum-decoration): Add highlighting operators. * test/lisp/progmodes/python-tests.el (python-font-lock-assignment-statement-1) (python-font-lock-assignment-statement-2) (python-font-lock-assignment-statement-3) (python-font-lock-assignment-statement-4) (python-font-lock-assignment-statement-5) (python-font-lock-assignment-statement-6) (python-font-lock-assignment-statement-7) (python-font-lock-assignment-statement-8) (python-font-lock-assignment-statement-9) (python-font-lock-assignment-statement-10) (python-font-lock-assignment-statement-11) (python-font-lock-assignment-statement-12) (python-font-lock-assignment-statement-13) (python-font-lock-assignment-statement-14) (python-font-lock-assignment-statement-15) (python-font-lock-assignment-statement-16) (python-font-lock-assignment-statement-17) (python-font-lock-assignment-statement-18) (python-font-lock-assignment-statement-multiline-1) (python-font-lock-assignment-statement-multiline-2) (python-font-lock-assignment-statement-multiline-3) (python-font-lock-assignment-statement-multiline-4) (python-font-lock-assignment-statement-multiline-5) (python-font-lock-assignment-statement-multiline-6) (python-font-lock-escape-sequence-multiline-string): Modify expectations to include faces for operators. (python-font-lock-operator-1, python-font-lock-operator-2): New tests. --- lisp/progmodes/python.el | 15 ++-- test/lisp/progmodes/python-tests.el | 108 +++++++++++++++++++++++----- 2 files changed, 100 insertions(+), 23 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index acfee21135..da43072316 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -454,7 +454,7 @@ python-rx (close-paren (or "}" "]" ")")) (simple-operator (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)) (not-simple-operator (not (or simple-operator ?\n))) - (operator (or "==" ">=" "is" "not" + (operator (or "==" ">=" "**" "//" "<<" ">>" "<=" "!=" "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" "=" "%")) @@ -791,6 +791,7 @@ python-font-lock-keywords-maximum-decoration (? (or ")" "]") (* sp-bsnl)) (group assignment-operator))) (1 font-lock-variable-name-face) + (2 'font-lock-operator-face) (,(python-rx grouped-assignment-target) (progn (goto-char (match-end 1)) ; go back after the first symbol @@ -806,8 +807,9 @@ python-font-lock-keywords-maximum-decoration (python-rx (or line-start ?\;) (* sp-bsnl) grouped-assignment-target (* sp-bsnl) (? ?: (* sp-bsnl) (+ not-simple-operator) (* sp-bsnl)) - assignment-operator)) - (1 font-lock-variable-name-face)) + (group assignment-operator))) + (1 font-lock-variable-name-face) + (2 'font-lock-operator-face)) ;; special cases ;; (a) = 5 ;; [a] = 5, @@ -817,8 +819,11 @@ python-font-lock-keywords-maximum-decoration (or "[" "(") (* sp-nl) grouped-assignment-target (* sp-nl) (or ")" "]") (* sp-bsnl) - assignment-operator)) - (1 font-lock-variable-name-face)) + (group assignment-operator))) + (1 font-lock-variable-name-face) + (2 'font-lock-operator-face)) + ;; Operators. + (,(python-rx operator) . 'font-lock-operator-face) ;; escape sequences within bytes literals ;; "\\" "\'" "\a" "\b" "\f" "\n" "\r" "\t" "\v" ;; "\ooo" character with octal value ooo diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index f871b7bc7d..5469f94900 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -280,28 +280,33 @@ python-font-lock-assignment-statement-1 "a, b, c = 1, 2, 3" '((1 . font-lock-variable-name-face) (2) (4 . font-lock-variable-name-face) (5) - (7 . font-lock-variable-name-face) (8)))) + (7 . font-lock-variable-name-face) (8) + (9 . font-lock-operator-face) (10)))) (ert-deftest python-font-lock-assignment-statement-2 () (python-tests-assert-faces "a, *b, c = 1, 2, 3, 4, 5" '((1 . font-lock-variable-name-face) (2) + (4 . font-lock-operator-face) (5 . font-lock-variable-name-face) (6) - (8 . font-lock-variable-name-face) (9)))) + (8 . font-lock-variable-name-face) (9) + (10 . font-lock-operator-face) (11)))) (ert-deftest python-font-lock-assignment-statement-3 () (python-tests-assert-faces "[a, b] = (1, 2)" '((1) (2 . font-lock-variable-name-face) (3) - (5 . font-lock-variable-name-face) (6)))) + (5 . font-lock-variable-name-face) (6) + (8 . font-lock-operator-face) (9)))) (ert-deftest python-font-lock-assignment-statement-4 () (python-tests-assert-faces "(l[1], l[2]) = (10, 11)" '((1) (2 . font-lock-variable-name-face) (3) - (8 . font-lock-variable-name-face) (9)))) + (8 . font-lock-variable-name-face) (9) + (14 . font-lock-operator-face) (15)))) (ert-deftest python-font-lock-assignment-statement-5 () (python-tests-assert-faces @@ -310,22 +315,29 @@ python-font-lock-assignment-statement-5 (2 . font-lock-variable-name-face) (3) (5 . font-lock-variable-name-face) (6) (8 . font-lock-variable-name-face) (9) + (11 . font-lock-operator-face) (12 . font-lock-variable-name-face) (13) + (15 . font-lock-operator-face) (16) + (17 . font-lock-operator-face) (18 . font-lock-variable-name-face) (19) - (21 . font-lock-variable-name-face) (22)))) + (21 . font-lock-variable-name-face) (22) + (23 . font-lock-operator-face) (24)))) (ert-deftest python-font-lock-assignment-statement-6 () (python-tests-assert-faces "(a,) = 'foo'," '((1) (2 . font-lock-variable-name-face) (3) + (6 . font-lock-operator-face) (7) (8 . font-lock-string-face) (13)))) (ert-deftest python-font-lock-assignment-statement-7 () (python-tests-assert-faces "(*a,) = ['foo', 'bar', 'baz']" '((1) + (2 . font-lock-operator-face) (3 . font-lock-variable-name-face) (4) + (7 . font-lock-operator-face) (8) (10 . font-lock-string-face) (15) (17 . font-lock-string-face) (22) (24 . font-lock-string-face) (29)))) @@ -334,6 +346,7 @@ python-font-lock-assignment-statement-8 (python-tests-assert-faces "d = D('a', ['b'], 'c')" '((1 . font-lock-variable-name-face) (2) + (3 . font-lock-operator-face) (4) (7 . font-lock-string-face) (10) (13 . font-lock-string-face) (16) (19 . font-lock-string-face) (22)))) @@ -344,7 +357,9 @@ python-font-lock-assignment-statement-9 '((1) (3 . font-lock-variable-name-face) (4) (8 . font-lock-variable-name-face) (9) + (14 . font-lock-operator-face) (15) (17 . font-lock-variable-name-face) (18) + (19 . font-lock-operator-face) (20) (21 . font-lock-string-face) (24) (26 . font-lock-string-face) (29) (31 . font-lock-string-face) (34) @@ -355,7 +370,8 @@ python-font-lock-assignment-statement-10 (python-tests-assert-faces "a: int = 5" '((1 . font-lock-variable-name-face) (2) - (4 . font-lock-builtin-face) (7)))) + (4 . font-lock-builtin-face) (7) + (8 . font-lock-operator-face) (9)))) (ert-deftest python-font-lock-assignment-statement-11 () (python-tests-assert-faces @@ -364,13 +380,15 @@ python-font-lock-assignment-statement-11 (19 . font-lock-builtin-face) (22) (40 . font-lock-builtin-face) (43) (46 . font-lock-builtin-face) (49) + (52 . font-lock-operator-face) (53) (55 . font-lock-constant-face) (59) (61 . font-lock-string-face) (66)))) (ert-deftest python-font-lock-assignment-statement-12 () (python-tests-assert-faces "c: Collection = {1, 2, 3}" - '((1 . font-lock-variable-name-face) (2)))) + '((1 . font-lock-variable-name-face) (2) + (15 . font-lock-operator-face) (16)))) (ert-deftest python-font-lock-assignment-statement-13 () (python-tests-assert-faces @@ -378,6 +396,7 @@ python-font-lock-assignment-statement-13 '((1 . font-lock-variable-name-face) (2) (12 . font-lock-builtin-face) (15) (17 . font-lock-builtin-face) (20) + (22 . font-lock-operator-face) (23) (28 . font-lock-string-face) (33) (38 . font-lock-string-face) (43)))) @@ -386,28 +405,38 @@ python-font-lock-assignment-statement-14 "(a) = 5; (b) = 6" '((1) (2 . font-lock-variable-name-face) (3) - (11 . font-lock-variable-name-face) (12)))) + (5 . font-lock-operator-face) (6) + (11 . font-lock-variable-name-face) (12) + (14 . font-lock-operator-face) (15)))) (ert-deftest python-font-lock-assignment-statement-15 () (python-tests-assert-faces "[a] = 5,; [b] = 6," '((1) (2 . font-lock-variable-name-face) (3) - (12 . font-lock-variable-name-face) (13)))) + (5 . font-lock-operator-face) (6) + (12 . font-lock-variable-name-face) (13) + (15 . font-lock-operator-face) (16)))) (ert-deftest python-font-lock-assignment-statement-16 () (python-tests-assert-faces "[*a] = 5, 6; [*b] = 7, 8" '((1) + (2 . font-lock-operator-face) (3 . font-lock-variable-name-face) (4) - (16 . font-lock-variable-name-face) (17)))) + (6 . font-lock-operator-face) (7) + (15 . font-lock-operator-face) + (16 . font-lock-variable-name-face) (17) + (19 . font-lock-operator-face) (20)))) (ert-deftest python-font-lock-assignment-statement-17 () (python-tests-assert-faces "(a) = (b) = 1" - `((1) + '((1) (2 . font-lock-variable-name-face) (3) - (8 . font-lock-variable-name-face) (9)))) + (5 . font-lock-operator-face) (6) + (8 . font-lock-variable-name-face) (9) + (11 . font-lock-operator-face) (12)))) (ert-deftest python-font-lock-assignment-statement-18 () (python-tests-assert-faces @@ -420,13 +449,21 @@ python-font-lock-assignment-statement-18 return res " '((1 . font-lock-variable-name-face) (10) + (11 . font-lock-operator-face) (12) (13 . font-lock-builtin-face) (16) (18 . font-lock-keyword-face) (21) (22 . font-lock-function-name-face) (23) + (38 . font-lock-operator-face) (40) (56 . font-lock-variable-name-face) (57) + (58 . font-lock-operator-face) (59) + (62 . font-lock-operator-face) (63) (70 . font-lock-variable-name-face) (72) + (94 . font-lock-operator-face) (95) + (102 . font-lock-operator-face) (103) (111 . font-lock-variable-name-face) (114) + (126 . font-lock-operator-face) (127) (128 . font-lock-builtin-face) (131) + (136 . font-lock-operator-face) (137) (144 . font-lock-keyword-face) (150)))) (ert-deftest python-font-lock-assignment-statement-multiline-1 () @@ -442,7 +479,8 @@ python-font-lock-assignment-statement-multiline-1 " '((1) (8 . font-lock-variable-name-face) (9) - (15 . font-lock-variable-name-face) (16)) + (15 . font-lock-variable-name-face) (16) + (19 . font-lock-operator-face) (20)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-2 () @@ -453,7 +491,9 @@ python-font-lock-assignment-statement-multiline-2 ] # 5, 6 " '((1) - (9 . font-lock-variable-name-face) (10)) + (8 . font-lock-operator-face) + (9 . font-lock-variable-name-face) (10) + (13 . font-lock-operator-face) (14)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-3 () @@ -471,7 +511,8 @@ python-font-lock-assignment-statement-multiline-3 3" '((1 . font-lock-variable-name-face) (2) (15 . font-lock-variable-name-face) (16) - (29 . font-lock-variable-name-face) (30)) + (29 . font-lock-variable-name-face) (30) + (36 . font-lock-operator-face) (37)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-4 () @@ -482,7 +523,8 @@ python-font-lock-assignment-statement-multiline-4 #\\ 5" '((1 . font-lock-variable-name-face) (2) - (15 . font-lock-builtin-face) (18)) + (15 . font-lock-builtin-face) (18) + (24 . font-lock-operator-face) (25)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-5 () @@ -500,7 +542,9 @@ python-font-lock-assignment-statement-multiline-5 6" '((1) (8 . font-lock-variable-name-face) (9) - (46 . font-lock-variable-name-face) (47)) + (18 . font-lock-operator-face) (19) + (46 . font-lock-variable-name-face) (47) + (60 . font-lock-operator-face) (61)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-6 () @@ -518,9 +562,33 @@ python-font-lock-assignment-statement-multiline-6 6" '((1) (7 . font-lock-variable-name-face) (8) - (43 . font-lock-variable-name-face) (44)) + (16 . font-lock-operator-face) (17) + (43 . font-lock-variable-name-face) (44) + (56 . font-lock-operator-face) (57)) "#" "=")) +(ert-deftest python-font-lock-operator-1 () + (python-tests-assert-faces + "1 << 2 ** 3 == +4%-5|~6&7^8%9" + '((1) + (3 . font-lock-operator-face) (5) + (8 . font-lock-operator-face) (10) + (13 . font-lock-operator-face) (15) + (16 . font-lock-operator-face) (17) + (18 . font-lock-operator-face) (20) + (21 . font-lock-operator-face) (23) + (24 . font-lock-operator-face) (25) + (26 . font-lock-operator-face) (27) + (28 . font-lock-operator-face) (29)))) + +(ert-deftest python-font-lock-operator-2 () + "Keyword operators are font-locked as keywords." + (python-tests-assert-faces + "is_ is None" + '((1) + (5 . font-lock-keyword-face) (7) + (8 . font-lock-constant-face)))) + (ert-deftest python-font-lock-escape-sequence-string-newline () (python-tests-assert-faces "'\\n' @@ -603,12 +671,16 @@ python-font-lock-escape-sequence-multiline-string (196 . font-lock-constant-face) (215 . font-lock-string-face) (218) (221 . font-lock-string-face) (254) + (259 . font-lock-operator-face) (260) (271 . font-lock-string-face) (274) (277 . font-lock-string-face) (310) + (315 . font-lock-operator-face) (316) (327 . font-lock-string-face) (330) (333 . font-lock-string-face) (366) + (371 . font-lock-operator-face) (372) (383 . font-lock-string-face) (386) (389 . font-lock-string-face) (422) + (427 . font-lock-operator-face) (428) (439 . font-lock-string-face) (442) (444 . font-lock-string-face) (497) (499 . font-lock-string-face) (552) -- 2.34.1 --Multipart_Sun_Nov_27_20:35:28_2022-1-- From unknown Mon Aug 18 11:07:39 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: kobarity Subject: bug#59629: closed (Re: bug#59629: Highlighting Python operators) Message-ID: References: <831qpji96b.fsf@gnu.org> X-Gnu-PR-Message: they-closed 59629 X-Gnu-PR-Package: emacs Reply-To: 59629@debbugs.gnu.org Date: Thu, 01 Dec 2022 12:47:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1669898822-10130-1" This is a multi-part message in MIME format... ------------=_1669898822-10130-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #59629: Highlighting Python operators 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 59629@debbugs.gnu.org. --=20 59629: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D59629 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1669898822-10130-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 59629-done) by debbugs.gnu.org; 1 Dec 2022 12:46:42 +0000 Received: from localhost ([127.0.0.1]:39502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0ixd-0002d9-Rb for submit@debbugs.gnu.org; Thu, 01 Dec 2022 07:46:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0ixa-0002d3-TP for 59629-done@debbugs.gnu.org; Thu, 01 Dec 2022 07:46:40 -0500 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 1p0ixU-0002m1-Ho; Thu, 01 Dec 2022 07:46:32 -0500 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=T2g1OcgV1kmWJc5X5Ck8uTejCNdJf6VU15VfFgYWQSg=; b=RyM1u7vBumE4 IP9gbV0gyALwAdf9NDcBMYkZ0gP8vsFjFb6cBeHnpShRbfhP7BQ/qIEP3Pkt4qp3HlLhwv4AxPtgH woZltFCfO+EhXt/MrXfojTPw2NooYGuV/0xfXtLu1wJFM87pXIb7tRUhKBhznMXuQbCxO1jlclcvv 48PG1hvAsu725JjJXcHoRcj0+qBAhzu/soxtA3SKXDp2sAm7Ox2XPfUt3aKHuWnsRPv0R++M6iLiN /F748B+Uhss3R8gJlMFDlc3zxS0t+rZloP8qmL4/v78KMhn9DktZnA3P7TAlSK0P+PEjLal/eh/qG 6hMJxvcFDEWseCf8jOkqvQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0ixT-0005WC-W4; Thu, 01 Dec 2022 07:46:32 -0500 Date: Thu, 01 Dec 2022 14:46:04 +0200 Message-Id: <831qpji96b.fsf@gnu.org> From: Eli Zaretskii To: kobarity In-Reply-To: (message from kobarity on Sun, 27 Nov 2022 20:35:28 +0900) Subject: Re: bug#59629: Highlighting Python operators References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59629-done Cc: 59629-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: -3.3 (---) > Date: Sun, 27 Nov 2022 20:35:28 +0900 > From: kobarity > > Now that font-lock-operator-face is defined, it might be useful to > highlight Python operators (without treesit). Attached is a patch to > highlight Python operators. Thanks, installed on the emacs-29 branch. ------------=_1669898822-10130-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Nov 2022 11:36:02 +0000 Received: from localhost ([127.0.0.1]:42200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozFx4-0001PL-1K for submit@debbugs.gnu.org; Sun, 27 Nov 2022 06:36:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:60814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozFwx-0001PB-De for submit@debbugs.gnu.org; Sun, 27 Nov 2022 06:36:00 -0500 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 1ozFww-0005wn-OG for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 06:35:54 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozFwt-00026D-PR for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 06:35:53 -0500 Received: by mail-pl1-x636.google.com with SMTP id 4so7735034pli.0 for ; Sun, 27 Nov 2022 03:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:subject:to:from:message-id:date:from:to:cc :subject:date:message-id:reply-to; bh=4cWw0bb7gnrKw7bI1iHQ2DGG6b05VFQ5/2wQvlmVvAg=; b=Q/R3TLuSK3nnVne1m9sJx2PqJhuslry55wXvcz+VKDmSB26rdjULeUK550YbBJhvXO 5KVtEmCwUK0gzuNYWC4EDrUaUpdENNlueG4gjGJDWyKs68s2lskzJRkGZtGxYXddA29B k+xL7IhYuZtRWnM8bhQ0LADKGsXjA9z7YS+eAGdOCwKjAxwiykA89bUuMymganHnRW4I 9mxfGXgz3K5vi5+0DmpokwIDcJ4cE7pRUOne+w/bM+wHsQpg2ItFgfiva9gLcCxH/krP Fl7g6vpZtf/WTg9bSDnT6LTzqCBh2z9GyupP7TMxw+wzLptYW/N9H5xfK61cBPg2fxGG mCrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:subject:to:from:message-id:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4cWw0bb7gnrKw7bI1iHQ2DGG6b05VFQ5/2wQvlmVvAg=; b=1mL0/G8fLL62KJjuy1MWFhPc0sIX4KQXHdapeOK80TMZ2kF7Q0DOqum9dvO6BPTBEN P19m7INwDTwmdbWz7fQdn9GXssa+409Cd3PdddpSZ5RHDTuKa3ZeawBzVL61nK+nrdaP STfXfu3E0n0+PD6toP9NVdU3y1zQNKBzO8SNoXNzpHx9IAu51y4NwlDxrV+f7hP2CGZI 1PuPqoKx0mXieBOLCnSL6XXUUGJ3UJpdTMT6W81oGhkhbehYwTPkMHsmcSkR9Q68bS/b BSgAjCCbvDjxZDeAo9MSna/bQwR+oyTq2ckk5t7x+ZpMdUy5SRnGk5wTB/E/hdlMiZ5q BkZw== X-Gm-Message-State: ANoB5pkxZS0iCdVuma2gyIR+0cpE0oIyc1Bx++pIUcDFboATDqcv9hZ0 T1jGWLoGn/9kST20dwM09mJJrqq4nLw= X-Google-Smtp-Source: AA0mqf4xcvw10I3VFCwMR2NzfYdIBancBZv80MkPXWLR28fLl5FKYj3tCfgD/mVfjGY2t7uv57CyrQ== X-Received: by 2002:a17:902:bc86:b0:189:1916:9bd4 with SMTP id bb6-20020a170902bc8600b0018919169bd4mr35696279plb.49.1669548949031; Sun, 27 Nov 2022 03:35:49 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id l9-20020a63f309000000b0046feca0883fsm4989151pgh.64.2022.11.27.03.35.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 03:35:47 -0800 (PST) Date: Sun, 27 Nov 2022 20:35:28 +0900 Message-ID: From: kobarity To: bug-gnu-emacs@gnu.org Subject: Highlighting Python operators User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sun_Nov_27_20:35:28_2022-1" Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=kobarity@gmail.com; helo=mail-pl1-x636.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 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 (--) --Multipart_Sun_Nov_27_20:35:28_2022-1 Content-Type: text/plain; charset=US-ASCII Hello, Now that font-lock-operator-face is defined, it might be useful to highlight Python operators (without treesit). Attached is a patch to highlight Python operators. Best Regards, --Multipart_Sun_Nov_27_20:35:28_2022-1 Content-Type: application/octet-stream; type=patch; name="0001-Add-highlighting-Python-operators.patch" Content-Disposition: attachment; filename="0001-Add-highlighting-Python-operators.patch" Content-Transfer-Encoding: 7bit >From 5d3a5e4179616c9d08def5ef36738d25b0f94e40 Mon Sep 17 00:00:00 2001 From: kobarity Date: Sun, 27 Nov 2022 18:52:32 +0900 Subject: [PATCH] Add highlighting Python operators * lisp/progmodes/python.el (python-rx): Remove "is" and "not" from operator. (python-font-lock-keywords-maximum-decoration): Add highlighting operators. * test/lisp/progmodes/python-tests.el (python-font-lock-assignment-statement-1) (python-font-lock-assignment-statement-2) (python-font-lock-assignment-statement-3) (python-font-lock-assignment-statement-4) (python-font-lock-assignment-statement-5) (python-font-lock-assignment-statement-6) (python-font-lock-assignment-statement-7) (python-font-lock-assignment-statement-8) (python-font-lock-assignment-statement-9) (python-font-lock-assignment-statement-10) (python-font-lock-assignment-statement-11) (python-font-lock-assignment-statement-12) (python-font-lock-assignment-statement-13) (python-font-lock-assignment-statement-14) (python-font-lock-assignment-statement-15) (python-font-lock-assignment-statement-16) (python-font-lock-assignment-statement-17) (python-font-lock-assignment-statement-18) (python-font-lock-assignment-statement-multiline-1) (python-font-lock-assignment-statement-multiline-2) (python-font-lock-assignment-statement-multiline-3) (python-font-lock-assignment-statement-multiline-4) (python-font-lock-assignment-statement-multiline-5) (python-font-lock-assignment-statement-multiline-6) (python-font-lock-escape-sequence-multiline-string): Modify expectations to include faces for operators. (python-font-lock-operator-1, python-font-lock-operator-2): New tests. --- lisp/progmodes/python.el | 15 ++-- test/lisp/progmodes/python-tests.el | 108 +++++++++++++++++++++++----- 2 files changed, 100 insertions(+), 23 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index acfee21135..da43072316 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -454,7 +454,7 @@ python-rx (close-paren (or "}" "]" ")")) (simple-operator (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)) (not-simple-operator (not (or simple-operator ?\n))) - (operator (or "==" ">=" "is" "not" + (operator (or "==" ">=" "**" "//" "<<" ">>" "<=" "!=" "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" "=" "%")) @@ -791,6 +791,7 @@ python-font-lock-keywords-maximum-decoration (? (or ")" "]") (* sp-bsnl)) (group assignment-operator))) (1 font-lock-variable-name-face) + (2 'font-lock-operator-face) (,(python-rx grouped-assignment-target) (progn (goto-char (match-end 1)) ; go back after the first symbol @@ -806,8 +807,9 @@ python-font-lock-keywords-maximum-decoration (python-rx (or line-start ?\;) (* sp-bsnl) grouped-assignment-target (* sp-bsnl) (? ?: (* sp-bsnl) (+ not-simple-operator) (* sp-bsnl)) - assignment-operator)) - (1 font-lock-variable-name-face)) + (group assignment-operator))) + (1 font-lock-variable-name-face) + (2 'font-lock-operator-face)) ;; special cases ;; (a) = 5 ;; [a] = 5, @@ -817,8 +819,11 @@ python-font-lock-keywords-maximum-decoration (or "[" "(") (* sp-nl) grouped-assignment-target (* sp-nl) (or ")" "]") (* sp-bsnl) - assignment-operator)) - (1 font-lock-variable-name-face)) + (group assignment-operator))) + (1 font-lock-variable-name-face) + (2 'font-lock-operator-face)) + ;; Operators. + (,(python-rx operator) . 'font-lock-operator-face) ;; escape sequences within bytes literals ;; "\\" "\'" "\a" "\b" "\f" "\n" "\r" "\t" "\v" ;; "\ooo" character with octal value ooo diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index f871b7bc7d..5469f94900 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -280,28 +280,33 @@ python-font-lock-assignment-statement-1 "a, b, c = 1, 2, 3" '((1 . font-lock-variable-name-face) (2) (4 . font-lock-variable-name-face) (5) - (7 . font-lock-variable-name-face) (8)))) + (7 . font-lock-variable-name-face) (8) + (9 . font-lock-operator-face) (10)))) (ert-deftest python-font-lock-assignment-statement-2 () (python-tests-assert-faces "a, *b, c = 1, 2, 3, 4, 5" '((1 . font-lock-variable-name-face) (2) + (4 . font-lock-operator-face) (5 . font-lock-variable-name-face) (6) - (8 . font-lock-variable-name-face) (9)))) + (8 . font-lock-variable-name-face) (9) + (10 . font-lock-operator-face) (11)))) (ert-deftest python-font-lock-assignment-statement-3 () (python-tests-assert-faces "[a, b] = (1, 2)" '((1) (2 . font-lock-variable-name-face) (3) - (5 . font-lock-variable-name-face) (6)))) + (5 . font-lock-variable-name-face) (6) + (8 . font-lock-operator-face) (9)))) (ert-deftest python-font-lock-assignment-statement-4 () (python-tests-assert-faces "(l[1], l[2]) = (10, 11)" '((1) (2 . font-lock-variable-name-face) (3) - (8 . font-lock-variable-name-face) (9)))) + (8 . font-lock-variable-name-face) (9) + (14 . font-lock-operator-face) (15)))) (ert-deftest python-font-lock-assignment-statement-5 () (python-tests-assert-faces @@ -310,22 +315,29 @@ python-font-lock-assignment-statement-5 (2 . font-lock-variable-name-face) (3) (5 . font-lock-variable-name-face) (6) (8 . font-lock-variable-name-face) (9) + (11 . font-lock-operator-face) (12 . font-lock-variable-name-face) (13) + (15 . font-lock-operator-face) (16) + (17 . font-lock-operator-face) (18 . font-lock-variable-name-face) (19) - (21 . font-lock-variable-name-face) (22)))) + (21 . font-lock-variable-name-face) (22) + (23 . font-lock-operator-face) (24)))) (ert-deftest python-font-lock-assignment-statement-6 () (python-tests-assert-faces "(a,) = 'foo'," '((1) (2 . font-lock-variable-name-face) (3) + (6 . font-lock-operator-face) (7) (8 . font-lock-string-face) (13)))) (ert-deftest python-font-lock-assignment-statement-7 () (python-tests-assert-faces "(*a,) = ['foo', 'bar', 'baz']" '((1) + (2 . font-lock-operator-face) (3 . font-lock-variable-name-face) (4) + (7 . font-lock-operator-face) (8) (10 . font-lock-string-face) (15) (17 . font-lock-string-face) (22) (24 . font-lock-string-face) (29)))) @@ -334,6 +346,7 @@ python-font-lock-assignment-statement-8 (python-tests-assert-faces "d = D('a', ['b'], 'c')" '((1 . font-lock-variable-name-face) (2) + (3 . font-lock-operator-face) (4) (7 . font-lock-string-face) (10) (13 . font-lock-string-face) (16) (19 . font-lock-string-face) (22)))) @@ -344,7 +357,9 @@ python-font-lock-assignment-statement-9 '((1) (3 . font-lock-variable-name-face) (4) (8 . font-lock-variable-name-face) (9) + (14 . font-lock-operator-face) (15) (17 . font-lock-variable-name-face) (18) + (19 . font-lock-operator-face) (20) (21 . font-lock-string-face) (24) (26 . font-lock-string-face) (29) (31 . font-lock-string-face) (34) @@ -355,7 +370,8 @@ python-font-lock-assignment-statement-10 (python-tests-assert-faces "a: int = 5" '((1 . font-lock-variable-name-face) (2) - (4 . font-lock-builtin-face) (7)))) + (4 . font-lock-builtin-face) (7) + (8 . font-lock-operator-face) (9)))) (ert-deftest python-font-lock-assignment-statement-11 () (python-tests-assert-faces @@ -364,13 +380,15 @@ python-font-lock-assignment-statement-11 (19 . font-lock-builtin-face) (22) (40 . font-lock-builtin-face) (43) (46 . font-lock-builtin-face) (49) + (52 . font-lock-operator-face) (53) (55 . font-lock-constant-face) (59) (61 . font-lock-string-face) (66)))) (ert-deftest python-font-lock-assignment-statement-12 () (python-tests-assert-faces "c: Collection = {1, 2, 3}" - '((1 . font-lock-variable-name-face) (2)))) + '((1 . font-lock-variable-name-face) (2) + (15 . font-lock-operator-face) (16)))) (ert-deftest python-font-lock-assignment-statement-13 () (python-tests-assert-faces @@ -378,6 +396,7 @@ python-font-lock-assignment-statement-13 '((1 . font-lock-variable-name-face) (2) (12 . font-lock-builtin-face) (15) (17 . font-lock-builtin-face) (20) + (22 . font-lock-operator-face) (23) (28 . font-lock-string-face) (33) (38 . font-lock-string-face) (43)))) @@ -386,28 +405,38 @@ python-font-lock-assignment-statement-14 "(a) = 5; (b) = 6" '((1) (2 . font-lock-variable-name-face) (3) - (11 . font-lock-variable-name-face) (12)))) + (5 . font-lock-operator-face) (6) + (11 . font-lock-variable-name-face) (12) + (14 . font-lock-operator-face) (15)))) (ert-deftest python-font-lock-assignment-statement-15 () (python-tests-assert-faces "[a] = 5,; [b] = 6," '((1) (2 . font-lock-variable-name-face) (3) - (12 . font-lock-variable-name-face) (13)))) + (5 . font-lock-operator-face) (6) + (12 . font-lock-variable-name-face) (13) + (15 . font-lock-operator-face) (16)))) (ert-deftest python-font-lock-assignment-statement-16 () (python-tests-assert-faces "[*a] = 5, 6; [*b] = 7, 8" '((1) + (2 . font-lock-operator-face) (3 . font-lock-variable-name-face) (4) - (16 . font-lock-variable-name-face) (17)))) + (6 . font-lock-operator-face) (7) + (15 . font-lock-operator-face) + (16 . font-lock-variable-name-face) (17) + (19 . font-lock-operator-face) (20)))) (ert-deftest python-font-lock-assignment-statement-17 () (python-tests-assert-faces "(a) = (b) = 1" - `((1) + '((1) (2 . font-lock-variable-name-face) (3) - (8 . font-lock-variable-name-face) (9)))) + (5 . font-lock-operator-face) (6) + (8 . font-lock-variable-name-face) (9) + (11 . font-lock-operator-face) (12)))) (ert-deftest python-font-lock-assignment-statement-18 () (python-tests-assert-faces @@ -420,13 +449,21 @@ python-font-lock-assignment-statement-18 return res " '((1 . font-lock-variable-name-face) (10) + (11 . font-lock-operator-face) (12) (13 . font-lock-builtin-face) (16) (18 . font-lock-keyword-face) (21) (22 . font-lock-function-name-face) (23) + (38 . font-lock-operator-face) (40) (56 . font-lock-variable-name-face) (57) + (58 . font-lock-operator-face) (59) + (62 . font-lock-operator-face) (63) (70 . font-lock-variable-name-face) (72) + (94 . font-lock-operator-face) (95) + (102 . font-lock-operator-face) (103) (111 . font-lock-variable-name-face) (114) + (126 . font-lock-operator-face) (127) (128 . font-lock-builtin-face) (131) + (136 . font-lock-operator-face) (137) (144 . font-lock-keyword-face) (150)))) (ert-deftest python-font-lock-assignment-statement-multiline-1 () @@ -442,7 +479,8 @@ python-font-lock-assignment-statement-multiline-1 " '((1) (8 . font-lock-variable-name-face) (9) - (15 . font-lock-variable-name-face) (16)) + (15 . font-lock-variable-name-face) (16) + (19 . font-lock-operator-face) (20)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-2 () @@ -453,7 +491,9 @@ python-font-lock-assignment-statement-multiline-2 ] # 5, 6 " '((1) - (9 . font-lock-variable-name-face) (10)) + (8 . font-lock-operator-face) + (9 . font-lock-variable-name-face) (10) + (13 . font-lock-operator-face) (14)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-3 () @@ -471,7 +511,8 @@ python-font-lock-assignment-statement-multiline-3 3" '((1 . font-lock-variable-name-face) (2) (15 . font-lock-variable-name-face) (16) - (29 . font-lock-variable-name-face) (30)) + (29 . font-lock-variable-name-face) (30) + (36 . font-lock-operator-face) (37)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-4 () @@ -482,7 +523,8 @@ python-font-lock-assignment-statement-multiline-4 #\\ 5" '((1 . font-lock-variable-name-face) (2) - (15 . font-lock-builtin-face) (18)) + (15 . font-lock-builtin-face) (18) + (24 . font-lock-operator-face) (25)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-5 () @@ -500,7 +542,9 @@ python-font-lock-assignment-statement-multiline-5 6" '((1) (8 . font-lock-variable-name-face) (9) - (46 . font-lock-variable-name-face) (47)) + (18 . font-lock-operator-face) (19) + (46 . font-lock-variable-name-face) (47) + (60 . font-lock-operator-face) (61)) "#" "=")) (ert-deftest python-font-lock-assignment-statement-multiline-6 () @@ -518,9 +562,33 @@ python-font-lock-assignment-statement-multiline-6 6" '((1) (7 . font-lock-variable-name-face) (8) - (43 . font-lock-variable-name-face) (44)) + (16 . font-lock-operator-face) (17) + (43 . font-lock-variable-name-face) (44) + (56 . font-lock-operator-face) (57)) "#" "=")) +(ert-deftest python-font-lock-operator-1 () + (python-tests-assert-faces + "1 << 2 ** 3 == +4%-5|~6&7^8%9" + '((1) + (3 . font-lock-operator-face) (5) + (8 . font-lock-operator-face) (10) + (13 . font-lock-operator-face) (15) + (16 . font-lock-operator-face) (17) + (18 . font-lock-operator-face) (20) + (21 . font-lock-operator-face) (23) + (24 . font-lock-operator-face) (25) + (26 . font-lock-operator-face) (27) + (28 . font-lock-operator-face) (29)))) + +(ert-deftest python-font-lock-operator-2 () + "Keyword operators are font-locked as keywords." + (python-tests-assert-faces + "is_ is None" + '((1) + (5 . font-lock-keyword-face) (7) + (8 . font-lock-constant-face)))) + (ert-deftest python-font-lock-escape-sequence-string-newline () (python-tests-assert-faces "'\\n' @@ -603,12 +671,16 @@ python-font-lock-escape-sequence-multiline-string (196 . font-lock-constant-face) (215 . font-lock-string-face) (218) (221 . font-lock-string-face) (254) + (259 . font-lock-operator-face) (260) (271 . font-lock-string-face) (274) (277 . font-lock-string-face) (310) + (315 . font-lock-operator-face) (316) (327 . font-lock-string-face) (330) (333 . font-lock-string-face) (366) + (371 . font-lock-operator-face) (372) (383 . font-lock-string-face) (386) (389 . font-lock-string-face) (422) + (427 . font-lock-operator-face) (428) (439 . font-lock-string-face) (442) (444 . font-lock-string-face) (497) (499 . font-lock-string-face) (552) -- 2.34.1 --Multipart_Sun_Nov_27_20:35:28_2022-1-- ------------=_1669898822-10130-1--