From eef65c9d6a0c65dd23b9e4b4473d709218e55b39 Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:56:55 -0700 Subject: Dlang: allow underscores for numbers and improve function matching (#275) * Dlang: allow underscores for numbers and improve function matching * Update version in manifest --- manifest.json | 2 +- plugins/language_d.lua | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index e21e8b9..320f1bb 100644 --- a/manifest.json +++ b/manifest.json @@ -447,7 +447,7 @@ }, { "description": "Syntax for the [D](https://dlang.org/) programming language", - "version": "0.1", + "version": "0.2", "path": "plugins/language_d.lua", "id": "language_d", "mod_version": "3" diff --git a/plugins/language_d.lua b/plugins/language_d.lua index 6788f0b..282c026 100644 --- a/plugins/language_d.lua +++ b/plugins/language_d.lua @@ -12,12 +12,11 @@ syntax.add { { pattern = { '`', '`', '\\' }, type = "string" }, { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, - { pattern = "-?0x%x+", type = "number" }, - { pattern = "-?%d+[%d%.eE]*f?", type = "number" }, + { pattern = "-?0x[%x_]+", type = "number" }, + { pattern = "-?[%d_]+[%d%.eE]*f?", type = "number" }, { pattern = "-?%.?%d+f?", type = "number" }, { pattern = "[%+%-=/%*%^%%<>!~|&%$]+", type = "operator" }, - { pattern = "[%a_][%w_]*!", type = "function" }, -- highlight templates - { pattern = "[%a_][%w_]*", type = "symbol" }, + { pattern = "[%a_][%w_]*!?()[%(.]", type = {"function", "normal"} }, -- highlight templates { pattern = "@safe", type = "keyword" }, { pattern = "@trusted", type = "keyword" }, { pattern = "@nogc", type = "keyword" }, @@ -134,4 +133,3 @@ syntax.add { ["__parameters"] = "keyword", }, } - -- cgit v1.2.3