From 25b5a059bfd3858a2c5d09873451155beafd5903 Mon Sep 17 00:00:00 2001 From: Nightwing Date: Mon, 29 Nov 2021 11:54:07 +0900 Subject: Added Initial scala support --- README.md | 1 + plugins/language_scala.lua | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 plugins/language_scala.lua diff --git a/README.md b/README.md index a49c21c..779d1c0 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ Plugin | Description [`language_rust`](plugins/language_rust.lua?raw=1) | Syntax for the [Rust](https://rust-lang.org/) programming language [`language_ruby`](plugins/language_ruby.lua?raw=1) | Syntax for the [Ruby](https://www.ruby-lang.org/) programming language [`language sass`](plugins/language_sass.lua?raw=1) | Syntax for the [Sass](https://sass-lang.com/) CSS preprocessor +[`language scala`](plugins/language_scala.lua?raw=1) | Syntax for the [Scala](https://scala-lang.org/) programming language [`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language [`language_ssh_config`](plugins/language_ssh_config.lua?raw=1) | Syntax for ssh & sshd config files [`language_tcl`](plugins/language_tcl.lua?raw=1) | Syntax for the [Tcl](https://www.tcl.tk/) programming language diff --git a/plugins/language_scala.lua b/plugins/language_scala.lua new file mode 100644 index 0000000..aa03e28 --- /dev/null +++ b/plugins/language_scala.lua @@ -0,0 +1,80 @@ +-- mod-version:2 -- lite-xl 2.0 +local syntax = require "core.syntax" + +syntax.add { + name = "Scala", + files = { "%.sc$", "%.scala$" }, + comment = "//", + patterns = { + { pattern = "//.-\n", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + { pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, + { pattern = { "[ruU]?'", "'", '\\' }, type = "string" }, + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, + { pattern = '[%a_][%w_]*"""*[%a_][%w_]*"""', type = "string" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["abstract"] = "keyword", + ["case"] = "keyword", + ["catch"] = "keyword", + ["class"] = "keyword", + ["finally"] = "keyword", + ["final"] = "keyword", + ["do"] = "keyword", + ["extends"] = "keyword", + ["forSome"] = "keyword", + ["implicit"] = "keyword", + ["lazy"] = "keyword", + ["match"] = "keyword", + ["new"] = "keyword", + ["override"] = "keyword", + ["package"] = "keyword", + ["throw"] = "keyword", + ["trait"] = "keyword", + ["type"] = "keyword", + ["var"] = "keyword", + ["val"] = "keyword", + ["println"] = "keyword", + ["return"] = "keyword", + ["for"] = "keyword", + ["Try"] = "keyword", + ["def"] = "keyword", + ["while"] = "keyword", + ["with"] = "keyword", + ["if"] = "keyword", + ["else"] = "keyword", + ["import"] = "keyword", + ["object"] = "keyword", + ["yield"] = "keyword", + + ["private"] = "keyword2", + ["protected"] = "keyword2", + ["sealed"] = "keyword2", + ["super"] = "keyword2", + ["this"] = "keyword2", + ["Byte"] = "keyword2", + ["Short"] = "keyword2", + ["Int"] = "keyword2", + ["Long"] = "keyword2", + ["Float"] = "keyword2", + ["Double"] = "keyword2", + ["Char"] = "keyword2", + ["String"] = "keyword2", + ["List"] = "keyword2", + ["Array"] = "keyword2", + ["Boolean"] = "keyword2", + + ["Null"] = "literal", + ["Any"] = "literal", + ["AnyRef"] = "literal", + ["Nothing"] = "literal", + ["Unit"] = "literal", + ["true"] = "literal", + ["false"] = "literal", + } +} -- cgit v1.2.3 From 4634f696dfba08be04777488716e19d51f667a66 Mon Sep 17 00:00:00 2001 From: Nightwing <94565465+JobinsJC@users.noreply.github.com> Date: Mon, 29 Nov 2021 11:57:08 +0900 Subject: Fixed Formatting --- plugins/language_scala.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/language_scala.lua b/plugins/language_scala.lua index aa03e28..fddadc7 100644 --- a/plugins/language_scala.lua +++ b/plugins/language_scala.lua @@ -65,8 +65,8 @@ syntax.add { ["Double"] = "keyword2", ["Char"] = "keyword2", ["String"] = "keyword2", - ["List"] = "keyword2", - ["Array"] = "keyword2", + ["List"] = "keyword2", + ["Array"] = "keyword2", ["Boolean"] = "keyword2", ["Null"] = "literal", -- cgit v1.2.3