diff options
author | PerilousBooklet <raffaele.orabona@protonmail.com> | 2024-07-20 01:21:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 01:21:14 +0200 |
commit | b4a9d65bba32ab33e9ffb922f57276615fe28463 (patch) | |
tree | 1074acaccd79f8316de93ddde53ec37ad8bb3bf8 /plugins | |
parent | febcc69c5069cd726d287f8cc913666a4960ac1e (diff) | |
download | lite-xl-plugins-b4a9d65bba32ab33e9ffb922f57276615fe28463.tar.gz lite-xl-plugins-b4a9d65bba32ab33e9ffb922f57276615fe28463.zip |
Add syntax highlighting for Java constants and class names when creating objects. (#385)
* Added pattern for java constants.
* Added regex pattern for java constants in language_java.
* Updated constants pattern.
* Fixed class name pattern and tidied up some things.
* Fixed redundant pattern.
* Updated single-line comment pattern.
* Bumped language_java version.
* Updated some patterns.
* Updated class name for object instance syntax.
* Removed limit on number of spaces before/after the = .
* Fixed previous commit.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/language_java.lua | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/plugins/language_java.lua b/plugins/language_java.lua index 30c1249..9fc5b7d 100644 --- a/plugins/language_java.lua +++ b/plugins/language_java.lua @@ -6,19 +6,21 @@ syntax.add { files = { "%.java$" }, comment = "//", patterns = { - { pattern = "//.-\n", type = "comment" }, - { pattern = { "/%*", "%*/" }, type = "comment" }, - { pattern = { '"', '"', '\\' }, type = "string" }, - { pattern = { "'", "'", '\\' }, type = "string" }, - { pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence - { pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence - { pattern = "'\\?.'", type = "string" }, -- character literal - { pattern = "-?0x%x+", type = "number" }, - { pattern = "-?%d+[%d%.eE]*f?", type = "number" }, - { pattern = "-?%.?%d+f?", type = "number" }, - { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, - { pattern = "[%a_][%w_]*%f[(]", type = "function" }, - { pattern = "[%a_][%w_]*", type = "symbol" }, + { pattern = "//.*", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence + { pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence + { pattern = "'\\?.'", type = "string" }, -- character literal + { pattern = "-?0x%x+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*f?", type = "number" }, + { pattern = "-?%.?%d+f?", type = "number" }, + { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { regex = "(?:\\w+\\.?)+(?=\\s+\\w++\\s*\\=\\s*)", type = "function" }, -- Class name when creating an object + { regex = "[A-Z][A-Z_]+", type = "keyword2" }, -- Constants + { pattern = "[%a_][%w_]*", type = "symbol" }, }, symbols = { ["abstract"] = "keyword", @@ -80,6 +82,6 @@ syntax.add { ["true"] = "literal", ["false"] = "literal", - ["null"] = "literal", - }, + ["null"] = "literal" + } } |