diff options
author | jgmdev <jgmdev@gmail.com> | 2022-02-09 19:09:26 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-02-09 19:09:26 -0400 |
commit | 301b27c775cc37b9547aebdb905f4c1600950781 (patch) | |
tree | 280a979e77c62ec8da62eb3a55296cdc6a1c4272 /plugins | |
parent | 92bbbeaab6a5ceec903d022c5e6fd864b05f5b81 (diff) | |
download | lite-xl-plugins-301b27c775cc37b9547aebdb905f4c1600950781.tar.gz lite-xl-plugins-301b27c775cc37b9547aebdb905f4c1600950781.zip |
Fixes to language_cpp and some additions.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/language_cpp.lua | 12 |
1 files changed, 11 insertions, 1 deletions
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", |