Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
504cf5f
Added pattern for java constants.
PerilousBooklet Mar 13, 2024
948d5f1
Added regex pattern for java constants in language_java.
PerilousBooklet Mar 13, 2024
b8a6e13
Merge branch 'lite-xl:master' into PR_language_java
PerilousBooklet Mar 14, 2024
25cf77f
Updated constants pattern.
PerilousBooklet Apr 13, 2024
aba7f5a
Fixed class name pattern and tidied up some things.
PerilousBooklet Apr 21, 2024
82eaff2
Fixed redundant pattern.
PerilousBooklet Apr 22, 2024
f5a9f14
Updated single-line comment pattern.
PerilousBooklet Apr 22, 2024
df0df4b
Bumped language_java version.
PerilousBooklet Apr 22, 2024
58034d8
Updated some patterns.
PerilousBooklet Apr 22, 2024
b29bbae
Merge branch 'master' into PR_language_java
PerilousBooklet Apr 22, 2024
aa8ad17
Updated class name for object instance syntax.
PerilousBooklet May 11, 2024
8f424a3
Removed limit on number of spaces before/after the = .
PerilousBooklet Jul 19, 2024
0bba117
Fixed previous commit.
PerilousBooklet Jul 19, 2024
b3791aa
WIP: fixing constants pattern.
PerilousBooklet Aug 10, 2024
f4d18dd
Updated pattern.
PerilousBooklet Oct 22, 2024
1a7e1be
Updated constants pattern.
PerilousBooklet Oct 22, 2024
d207d8a
Fixed REDOs vulnerability for class pattern.
PerilousBooklet Oct 27, 2024
4ad3d68
Merge branch 'master' into PR_java_constants
PerilousBooklet Oct 27, 2024
f292109
Updated branch
PerilousBooklet Oct 27, 2024
322983c
version bump.
PerilousBooklet Oct 27, 2024
07ed366
Fixed constants pattern.
PerilousBooklet Nov 29, 2024
5c28202
Fixed constants pattern (for real this time).
PerilousBooklet Nov 29, 2024
fa37fd8
Removed some comments.
PerilousBooklet Nov 29, 2024
73f2677
Updated Groovy syntax.
PerilousBooklet Nov 30, 2024
ef8cb19
Updated Kotlin syntax.
PerilousBooklet Nov 30, 2024
e9e0f95
WIP: updating Java syntax.
PerilousBooklet Nov 30, 2024
545a6ae
WIP: updating/fixing patterns.
PerilousBooklet Nov 30, 2024
fdede88
Fixed constants pattern interference in import statements.
PerilousBooklet Dec 1, 2024
92d91a4
Added method reference pattern and WIP: fixing patterns.
PerilousBooklet Dec 3, 2024
4746bd1
Replaced regex pattern with lua pattern and other things.
PerilousBooklet Dec 14, 2024
6a51acb
Updated basic annotations pattern.
PerilousBooklet Dec 14, 2024
861443f
Fixed redundant % from a few lua patterns.
PerilousBooklet Dec 14, 2024
37ac183
WIP: fixing constants pattern
PerilousBooklet Dec 23, 2024
34f1b50
Fixed constants and generic class name reference patterns.
PerilousBooklet Dec 29, 2024
44ddc32
Fixed class name pattern.
PerilousBooklet Jan 3, 2025
717f927
Updated constants patterns for groovy and kotlin.
PerilousBooklet Jan 5, 2025
6e4209a
WIP: Tidying some things up and fixing class name reference patterns …
PerilousBooklet Jan 7, 2025
e43c374
Fixed Java/Kotlin/Groovy constants and class patterns; fixed all rege…
PerilousBooklet Jan 7, 2025
df627b5
Added missing match case to Java class name reference pattern: type r…
PerilousBooklet Jan 7, 2025
a634bd7
WIP: updating annotation pattern.
PerilousBooklet Jan 15, 2025
1c29f53
WIP: fixing patterns...
PerilousBooklet Jan 19, 2025
bd262ce
WIP: ...
PerilousBooklet Jan 30, 2025
d1ebcc6
WIP: fixing patterns...
PerilousBooklet Feb 4, 2025
2cb662f
WIP: fixing patterns
PerilousBooklet Feb 10, 2025
4a65e90
WIP: fixing patterns
PerilousBooklet Feb 23, 2025
588e5d4
Updated java annotation patterns and removed java class patterns; upd…
PerilousBooklet Feb 25, 2025
a65e754
WIP: fixing class name reference pattern.
PerilousBooklet Mar 22, 2025
b63d5a5
WIP: reworked class reference patterns, only 2 pattern fixes remaining.
PerilousBooklet Apr 23, 2025
bf2350f
Fixed typo.
PerilousBooklet Apr 23, 2025
cd773e0
Fixed class patterns for most common instances.
PerilousBooklet Apr 28, 2025
7ab827a
WIP: fixing patterns....
PerilousBooklet Apr 30, 2025
25ebcb7
WIP: fixing patterns
PerilousBooklet May 15, 2025
bca9f37
WIP: fixing patterns
PerilousBooklet Jun 2, 2025
304077f
WIP: fixing some more patterns for Class name references.
PerilousBooklet Jul 25, 2025
8e8ca22
WIP: fixing last few class name reference patterns.
PerilousBooklet Jul 26, 2025
e84d7b2
Fixed last class name reference pattern.
PerilousBooklet Jul 26, 2025
a788698
Finally fixed Method patterns and too many other changes
PerilousBooklet Aug 30, 2025
1062499
WIP: fixing stuff
PerilousBooklet Sep 16, 2025
fbe9522
Removed class reference patterns; fixed remaining base patterns; chan…
PerilousBooklet Oct 1, 2025
1527dfd
Fixed and added a few more patterns
PerilousBooklet Oct 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1063,14 +1063,14 @@
"version": "0.1"
},
{
"description": "Syntax for the [Groovy](https://en.wikipedia.org/wiki/Apache_Groovy) programming language",
"description": "Syntax for the [Groovy](https://en.wikipedia.org/wiki/Apache_Groovy) programming language.",
"id": "language_groovy",
"mod_version": "3",
"path": "plugins/language_groovy.lua",
"tags": [
"language"
],
"version": "0.2"
"version": "0.3"
},
{
"description": "Syntax for the [Hare](https://harelang.org) programming language",
Expand Down Expand Up @@ -1143,14 +1143,14 @@
"version": "0.1"
},
{
"description": "Syntax for the [Java](https://en.wikipedia.org/wiki/Java_\\(programming_language\\)) programming language",
"description": "Syntax for the [Java](https://en.wikipedia.org/wiki/Java_\\(programming_language\\)) programming language.",
"id": "language_java",
"mod_version": "3",
"path": "plugins/language_java.lua",
"tags": [
"language"
],
"version": "0.1.3"
"version": "0.1.4"
},
{
"description": "Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language",
Expand Down Expand Up @@ -1203,14 +1203,14 @@
"version": "0.1"
},
{
"description": "Syntax for the [Kotlin](https://kotlinlang.org/docs/home.html) programming language",
"description": "Syntax for the [Kotlin](https://kotlinlang.org/docs/home.html) programming language.",
"id": "language_kotlin",
"mod_version": "3",
"path": "plugins/language_kotlin.lua",
"tags": [
"language"
],
"version": "0.2"
"version": "0.3"
},
{
"checksum": "08a9f8635b09a98cec9dfca8bb65f24fd7b6585c7e8308773e7ddff9a3e5a60f",
Expand Down
46 changes: 24 additions & 22 deletions plugins/language_groovy.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
-- mod-version:3
local syntax = require "core.syntax"

-- Language Syntax References
-- https://groovy-lang.org/syntax.html

syntax.add {
name = "Groovy",
files = { "%.groovy$" },
files = { "%.groovy$", "%.gvy$", "%.gy$", "%.gsh$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
{ pattern = "//.*", type = "comment" }, -- Single-line comment
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- Multi-line comment
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String, double quotes
{ pattern = { "'", "'", '\\' }, type = "string" }, -- String, apices
{ pattern = { "%/", "%/", '\\' }, type = "string" }, -- Slashy string
{ pattern = { "%$%/", "%/%$", '\\' }, type = "string" }, -- Dollar slashy 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]*[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "-?%.?%d+", type = "number" }, -- ?
{ pattern = "-?[%d_+]+[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, -- Operators
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Function/Class/Method/...
{ pattern = "[%a_][%w_]*%f[%[]", type = "function" }, -- Custom Type
{ regex = "[A-Z]+_?[A-Z]+", type = "keyword2" }, -- Constants
{ pattern = "import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } },
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- ?
{ pattern = "[a-zA-Z]+%.+", type = "function" }, -- Lib path
-- TODO: .class.
{ pattern = "//.*", type = "comment" }, -- Single-line comment
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- Multi-line comment
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String, double quotes (also matches triple quotes for multi-line string)
{ pattern = { "'", "'", '\\' }, type = "string" }, -- String, apices
{ pattern = { "%/", "%/", '\\' }, type = "string" }, -- Slashy string
{ pattern = { "%$%/", "%/%$", '\\' }, type = "string" }, -- Dollar slashy 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]*[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "-?%.?%d+", type = "number" }, -- ?
{ pattern = "-?[%d_+]+[a-zA-Z]?", type = "number" }, -- ?
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, -- Operators
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Function/Method/Class/...
{ pattern = "[%a_][%w_]*%f[%[]", type = "function" }, -- Custom Type
{ regex = [[[A-Z](?:[A-Z_][\d]*)+(?!\w)]], type = "keyword2" }, -- Constants
{ pattern = "import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } },
{ pattern = "%.class", type = "normal" }, -- .class should be colored as normal
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- ?
},
symbols = {
-- Reserved keywords
Expand Down
59 changes: 33 additions & 26 deletions plugins/language_java.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
-- mod-version:3
local syntax = require "core.syntax"

-- Language Syntax References
-- https://docs.oracle.com/javase/specs/jls/se8/html/index.html

syntax.add {
name = "Java",
files = { "%.java$" },
comment = "//",
patterns = {
{ 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" },
{ pattern = "//.*", type = "comment" }, -- Single-line comment
{ pattern = { "/%*", "%*/" }, type = "comment" }, -- Multi-line comment
{ pattern = { '"', '"', '\\' }, type = "string" }, -- String
{ pattern = { "'", "'", '\\' }, type = "string" }, -- 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" }, -- Number: hexadecimal
{ pattern = "-?%d+[%d%.eE]*[fFdD]?", type = "number" }, -- Number: exponential, float/double
{ pattern = "%<.-%>%>*", type = "keyword2" }, -- Generic
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, -- Operator
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Method
{ pattern = "^import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } }, -- Import
{ pattern = "[A-Z][A-Z_%d]+%f[^a-zA-Z_%d]", type = "keyword2" }, -- Constants
{ pattern = "this()%s*.*$", type = { "keyword", "normal" } }, -- FIX: ?
{ pattern = "%@%w+", type = "keyword2" }, -- Annotation
{ pattern = "%:%:()%w+", type = { "normal", "function" } }, -- Method reference with double colon operator
{ pattern = "%.class", type = "normal" }, -- .class should be colored as normal
{ pattern = "[%a_][%w_]*", type = "symbol" } -- Symbols
},
symbols = {
["abstract"] = "keyword",
Expand Down Expand Up @@ -71,17 +78,17 @@ syntax.add {
["while"] = "keyword",
["yield"] = "keyword",

["boolean"] = "keyword2",
["byte"] = "keyword2",
["char"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["int"] = "keyword2",
["long"] = "keyword2",
["short"] = "keyword2",
["boolean"] = "keyword",
["byte"] = "keyword",
["char"] = "keyword",
["double"] = "keyword",
["float"] = "keyword",
["int"] = "keyword",
["long"] = "keyword",
["short"] = "keyword",

["true"] = "literal",
["false"] = "literal",
["null"] = "literal"
["true"] = "literal",
["false"] = "literal",
["null"] = "literal"
}
}
21 changes: 13 additions & 8 deletions plugins/language_kotlin.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
-- mod-version:3
local syntax = require "core.syntax"

-- Language Syntax References
-- https://kotlinlang.org/docs/basic-syntax.html
-- https://kotlinlang.org/docs/keyword-reference.html

syntax.add {
name = "Kotlin",
files = { "%.kt$" },
files = { "%.kts?$", "%.klib$" },
comment = "//",
block_comment = { "/*", "*/" },
patterns = {
Expand All @@ -14,23 +18,23 @@ syntax.add {
{ 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 = "%<.-%>%>*", type = "keyword2" }, -- Generic
{ pattern = "-?0x%x+", type = "number" }, -- ?
{ pattern = "-?%d+[%deE]*f?", type = "number" }, -- ?
{ pattern = "-?%.?%d+f?", type = "number" }, -- ?
{ regex = [[\-\>(?=\s)]], type = "operator" }, -- Lambda
{ regex = [[\.{2}\<?\s?(?=[\\-]?[a-z0-9])]], type = "operator" }, -- Range operators
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, -- Operators
{ regex = [[\?(?=\.)]], type = "operator" }, -- ?. operator
{ pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- Function/Method/Class
{ regex = "`[\\w_\\s]+`(?=\\s*\\()", type = "function" }, -- Test Method
{ regex = [[`[\w_\s]+`(?=\s*\()]], type = "function" }, -- Test Method
{ regex = [[let(?=\s\{)]], type = "function" }, -- ? operator
{ regex = [[\?\:(?=\s?)]], type = "operator" }, -- elvis operator
{ regex = [[this(?=\.?\@?)]], type = "keyword" }, -- this keyword
{ regex = "\\@\\w+", type = "keyword2" }, -- Annotations
{ regex = [[[a-zA-Z]+\@(?=\s?[a-zA-Z])]], type = "keyword2" }, -- Annotations (this pattern is lower priority than the `this keyword` pattern)
{ regex = "[A-Z][A-Z_]+", type = "keyword2" }, -- Constants, FULL UPPERCASE
{ pattern = "import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } },
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- ?
{ pattern = "%@[%w%.]+", type = "keyword2" }, -- Annotation
{ pattern = "^import()%s+()[%w_.]+", type = { "keyword", "normal", "normal" } },
{ pattern = "[A-Z][A-Z_%d]+%f[^a-zA-Z_%d]", type = "keyword2" }, -- Constants
{ pattern = "%:%s()%w+", type = { "normal", "function" } }, -- Type reference
{ pattern = "[%a_][%w_]*", type = "symbol" }, -- Symbols
},
symbols = {
-- Hard keywords
Expand Down Expand Up @@ -81,6 +85,7 @@ syntax.add {
["setparam"] = "keyword",
["value"] = "keyword",
["where"] = "keyword",
["to"] = "keyword",

-- Modifier keywords
["abstract"] = "keyword",
Expand Down