From 301b27c775cc37b9547aebdb905f4c1600950781 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 9 Feb 2022 19:09:26 -0400 Subject: Fixes to language_cpp and some additions. --- plugins/language_cpp.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins/language_cpp.lua') diff --git a/plugins/language_cpp.lua b/plugins/language_cpp.lua index 8cd36a4..e3de669 100644 --- a/plugins/language_cpp.lua +++ b/plugins/language_cpp.lua @@ -20,7 +20,16 @@ syntax.add { { pattern = "-?%.?%d+f?", type = "number" }, { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, { pattern = "[%a_][%w_]*%f[(]", type = "function" }, - { pattern = "#[%a_][%w_]*", type = "symbol" }, + -- Match scope operator element access + { pattern = "[%a_][%w_]*[%s]*%f[:]",type = "literal" }, + -- Uppercase constants of at least 3 characters in len + { pattern = "%u[%u_][%u%d_]+", type = "number" }, + -- Magic constants + { pattern = "__[%u]+__", type = "number" }, + -- Somehow makes macros properly work + { pattern = "#[%a_][%w_]*", type = "symbol" }, + -- Everything else to make the tokenizer work properly + { pattern = "[%a_][%w_]*", type = "symbol" }, }, symbols = { ["alignof"] = "keyword", @@ -122,6 +131,7 @@ syntax.add { ["#if"] = "keyword", ["#ifdef"] = "keyword", ["#ifndef"] = "keyword", + ["#elif"] = "keyword", ["#else"] = "keyword", ["#elseif"] = "keyword", ["#endif"] = "keyword", -- cgit v1.2.3