From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66162: [PATCH] Various fixes to lua-ts-mode font-locking Date: Fri, 22 Sep 2023 18:43:43 -0500 Message-ID: <871qepzrhn.fsf@pub.pink> Reply-To: john muhl Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19294"; mail-complaints-to="usenet@ciao.gmane.io" To: 66162@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 23 02:04:28 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjq8J-0004mO-U3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Sep 2023 02:04:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjq7m-0007Op-0h; Fri, 22 Sep 2023 20:03:54 -0400 Original-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 1qjq7k-0007Nu-E2 for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2023 20:03:52 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qjq7j-0005vK-QH for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2023 20:03:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qjq7t-0000ks-Qx for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2023 20:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Sep 2023 00:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66162 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16954273982851 (code B ref -1); Sat, 23 Sep 2023 00:04:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Sep 2023 00:03:18 +0000 Original-Received: from localhost ([127.0.0.1]:37504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjq78-0000jr-9r for submit@debbugs.gnu.org; Fri, 22 Sep 2023 20:03:18 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:57158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjq6r-0000j9-Lu for submit@debbugs.gnu.org; Fri, 22 Sep 2023 20:03:12 -0400 Original-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 1qjq6a-0007G0-FX for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2023 20:02:40 -0400 Original-Received: from out-196.mta1.migadu.com ([95.215.58.196]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjq6Y-0005oo-1J for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2023 20:02:40 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; s=key1; t=1695427352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=D+HN7C1o6I15W0LkbAtrKfAZ+w7Ij1m3BdPY9t/B/wA=; b=YmKicL56LQkiTG74teDYsJTdfM0xJoB2XMGI6SwOWaSb6BC+8ez6lYpq5bJbXOfF8QLAST WY0j8/nliul/EAd0BudgbRbYAhFrbDOjHGBRQ2VXPdzYfPGKZxTfkhwXm03dIDQOGnAEIU PmGMbuLbeSHfRsLatbT8oo0gn84W5aY= X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=95.215.58.196; envelope-from=jm@pub.pink; helo=out-196.mta1.migadu.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271131 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Here are some fixes around font-locking mostly to do with functions and assignments; e.g. f1 = function() end now correctly marks f1 as a function name. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Various-fixes-to-lua-ts-mode-font-locking.patch >From df023cab8834477c63adf7fdc88afa1871c0fc96 Mon Sep 17 00:00:00 2001 From: john muhl Date: Fri, 22 Sep 2023 18:36:18 -0500 Subject: [PATCH] Various fixes to lua-ts-mode font-locking * lisp/progmodes/lua-ts-mode.el (lua-ts--font-lock-settings): Identify functions and assignments in more places. Use constant face for goto/labels. --- lisp/progmodes/lua-ts-mode.el | 56 +++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 071953d3d2f..030a3585158 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -121,7 +121,9 @@ lua-ts--font-lock-settings :feature 'constant '((variable_list attribute: (attribute (["<" ">"] (identifier)))) - @font-lock-constant-face) + @font-lock-constant-face + (goto_statement (identifier) @font-lock-constant-face) + (label_statement) @font-lock-constant-face) :language 'lua :feature 'operator @@ -131,12 +133,6 @@ lua-ts--font-lock-settings @font-lock-operator-face (vararg_expression) @font-lock-operator-face) - :language 'lua - :feature 'property - '((field name: (identifier) @font-lock-property-name-face) - (dot_index_expression - field: (identifier) @font-lock-property-use-face)) - :language 'lua :feature 'builtin `(((identifier) @font-lock-builtin-face @@ -150,8 +146,7 @@ lua-ts--font-lock-settings name: (method_index_expression method: (identifier) @font-lock-function-call-face)) (function_call - name: (dot_index_expression - table: (identifier) @font-lock-function-call-face))) + name: (dot_index_expression (identifier) @font-lock-function-call-face))) :language 'lua :feature 'punctuation @@ -164,12 +159,7 @@ lua-ts--font-lock-settings @font-lock-variable-use-face) (function_call name: (method_index_expression - table: (identifier) @font-lock-variable-use-face)) - (goto_statement (identifier) @font-lock-variable-use-face)) - - :language 'lua - :feature 'assignment - '((variable_list (identifier) @font-lock-variable-name-face)) + table: (identifier) @font-lock-variable-use-face))) :language 'lua :feature 'number @@ -199,9 +189,43 @@ lua-ts--font-lock-settings :feature 'definition '((function_declaration name: (identifier) @font-lock-function-name-face) + (assignment_statement + (variable_list name: [(identifier)]) @font-lock-function-name-face + (expression_list value: (function_definition))) + (table_constructor + (field + name: (identifier) @font-lock-function-name-face + value: (function_definition))) + (function_declaration + name: (dot_index_expression (identifier) @font-lock-function-name-face)) + (function_declaration + name: (method_index_expression (identifier) @font-lock-function-name-face)) + (function_declaration + (method_index_expression + (dot_index_expression + table: (identifier) @font-lock-function-name-face + field: (identifier) @font-lock-property-name-face + ))) (parameters name: (identifier) @font-lock-variable-name-face) - (label_statement) @font-lock-variable-name-face) + (for_numeric_clause name: (identifier) @font-lock-variable-name-face)) + + :language 'lua + :feature 'property + '((field name: (identifier) @font-lock-property-name-face) + (dot_index_expression + field: (identifier) @font-lock-property-use-face)) + + :language 'lua + :feature 'assignment + '((variable_list + [(identifier) + (bracket_index_expression)] + @font-lock-variable-name-face) + (variable_list + (dot_index_expression + table: (identifier)) + @font-lock-variable-name-face)) :language 'lua :feature 'error -- 2.41.0 --=-=-=--