From be05d27c35e360f587d5b5c5e56de8bdec2bfb1b Mon Sep 17 00:00:00 2001 From: Fiji <156847941+FijiHasGithub@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:24:52 +0000 Subject: [PATCH 1/3] Improve number highlighting for python syntax highlighting Adds support for octal and binary representation, as well uppercase characters (X, B and O) --- data/plugins/language_python.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/plugins/language_python.lua b/data/plugins/language_python.lua index 743e990a8..81a9538f5 100644 --- a/data/plugins/language_python.lua +++ b/data/plugins/language_python.lua @@ -16,7 +16,7 @@ syntax.add { { pattern = { "[ruU]?'''", "'''", '\\' }, type = "string" }, { pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, { pattern = { "[ruU]?'", "'", '\\' }, type = "string" }, - { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "0[x|b|o|X|B|O][%da-fA-F]+", type = "number" }, { pattern = "-?%d+[%d%.eE]*", type = "number" }, { pattern = "-?%.?%d+", type = "number" }, { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, From f80338b2862ea5deb8ab2d7f14995f589cbeffa5 Mon Sep 17 00:00:00 2001 From: Fiji <156847941+FijiHasGithub@users.noreply.github.com> Date: Fri, 19 Jan 2024 17:03:18 +0000 Subject: [PATCH 2/3] add underscore and negative hex/oct/bin value support --- data/plugins/language_python.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/plugins/language_python.lua b/data/plugins/language_python.lua index 81a9538f5..51a414333 100644 --- a/data/plugins/language_python.lua +++ b/data/plugins/language_python.lua @@ -16,8 +16,8 @@ syntax.add { { pattern = { "[ruU]?'''", "'''", '\\' }, type = "string" }, { pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, { pattern = { "[ruU]?'", "'", '\\' }, type = "string" }, - { pattern = "0[x|b|o|X|B|O][%da-fA-F]+", type = "number" }, - { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?0[x|b|o|X|B|O][%da-fA-F_]+",type = "number" }, + { pattern = "-?%d+[%d%.eE_]*", type = "number" }, { pattern = "-?%.?%d+", type = "number" }, { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, { pattern = "[%a_][%w_]*%f[(]", type = "function" }, From c1b69a5da48d9ec2d9ab5ef6f3c515e4a8add57f Mon Sep 17 00:00:00 2001 From: Fiji <156847941+FijiHasGithub@users.noreply.github.com> Date: Sat, 20 Jan 2024 00:02:33 +0000 Subject: [PATCH 3/3] Removed | from pattern --- data/plugins/language_python.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/plugins/language_python.lua b/data/plugins/language_python.lua index 51a414333..220ddd545 100644 --- a/data/plugins/language_python.lua +++ b/data/plugins/language_python.lua @@ -16,7 +16,7 @@ syntax.add { { pattern = { "[ruU]?'''", "'''", '\\' }, type = "string" }, { pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, { pattern = { "[ruU]?'", "'", '\\' }, type = "string" }, - { pattern = "-?0[x|b|o|X|B|O][%da-fA-F_]+",type = "number" }, + { pattern = "-?0[xboXBO][%da-fA-F_]+",type = "number" }, { pattern = "-?%d+[%d%.eE_]*", type = "number" }, { pattern = "-?%.?%d+", type = "number" }, { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },