From c56ff7f1b02523c96d6f5d7077e884797654cf62 Mon Sep 17 00:00:00 2001 From: Melissa Geels Date: Sat, 9 May 2020 14:23:11 +0200 Subject: Added Angelscript language plugin --- README.md | 1 + plugins/language_angelscript.lua | 86 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 plugins/language_angelscript.lua diff --git a/README.md b/README.md index d9e8654..f25112a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Plugin | Description [`gofmt`](plugins/gofmt.lua?raw=1) | Auto-formats the current go file, adds the missing imports and the missing return cases [`hidestatus`](plugins/hidestatus.lua?raw=1) | Hides the status bar at the bottom of the window [`indentguide`](plugins/indentguide.lua?raw=1) | Adds indent guides *([screenshot](https://user-images.githubusercontent.com/3920290/79640716-f9860000-818a-11ea-9c3b-26d10dd0e0c0.png))* +[`language_angelscript`](plugins/language_angelscript.lua?raw=1) | Syntax for the [Angelscript](https://www.angelcode.com/angelscript/) programming language [`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.org/) programming language [`language_fe`](plugins/language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language [`language_go`](plugins/language_go.lua?raw=1) | Syntax for the [Go](https://golang.org/) programming language diff --git a/plugins/language_angelscript.lua b/plugins/language_angelscript.lua new file mode 100644 index 0000000..8c39cff --- /dev/null +++ b/plugins/language_angelscript.lua @@ -0,0 +1,86 @@ +local syntax = require "core.syntax" + +syntax.add { + files = { "%.as$", "%.asc$" }, + comment = "//", + patterns = { + { pattern = "//.-\n", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + { pattern = { "#", "[^\\]\n" }, type = "comment" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = "-?0[xX]%x+", type = "number" }, + { pattern = "-?0[bB][0-1]+", type = "number" }, + { pattern = "-?0[oO][0-7]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*f?", type = "number" }, + { pattern = "-?%.?%d+f?", type = "number" }, + { pattern = "&inout", type = "keyword" }, + { pattern = "&in", type = "keyword" }, + { pattern = "&out", type = "keyword" }, + { pattern = "[%a_][%w_]*@", type = "keyword2" }, + { pattern = "[%-%+!~@%?:&|%^<>%*/=%%]", type = "operator" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + -- Common + ["shared"] = "keyword", + ["external"] = "keyword", + ["private"] = "keyword", + ["protected"] = "keyword", + ["const"] = "keyword", + ["final"] = "keyword", + ["abstract"] = "keyword", + ["class"] = "keyword", + ["typedef"] = "keyword", + ["namespace"] = "keyword", + ["interface"] = "keyword", + ["import"] = "keyword", + ["enum"] = "keyword", + ["funcdef"] = "keyword", + ["get"] = "keyword", + ["set"] = "keyword", + ["mixin"] = "keyword", + ["void"] = "keyword2", + ["int"] = "keyword2", + ["int8"] = "keyword2", + ["int16"] = "keyword2", + ["int32"] = "keyword2", + ["int64"] = "keyword2", + ["uint"] = "keyword2", + ["uint8"] = "keyword2", + ["uint16"] = "keyword2", + ["uint32"] = "keyword2", + ["uint64"] = "keyword2", + ["float"] = "keyword2", + ["double"] = "keyword2", + ["bool"] = "keyword2", + ["auto"] = "keyword", + ["override"] = "keyword", + ["explicit"] = "keyword", + ["property"] = "keyword", + ["break"] = "keyword", + ["continue"] = "keyword", + ["return"] = "keyword", + ["switch"] = "keyword", + ["case"] = "keyword", + ["default"] = "keyword", + ["for"] = "keyword", + ["while"] = "keyword", + ["do"] = "keyword", + ["if"] = "keyword", + ["else"] = "keyword", + ["try"] = "keyword", + ["catch"] = "keyword", + ["cast"] = "keyword", + ["function"] = "keyword", + ["true"] = "literal", + ["false"] = "literal", + ["null"] = "literal", + ["is"] = "operator", + ["and"] = "operator", + ["or"] = "operator", + ["xor"] = "operator", + }, +} + -- cgit v1.2.3