aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_gdscript.lua
diff options
context:
space:
mode:
authorMarco <marco.galli@protonmail.com>2020-05-24 09:58:26 +0200
committerMarco <marco.galli@protonmail.com>2020-05-24 09:58:26 +0200
commit438d18e6db5107d865a68c7c42cb0c41859edba5 (patch)
tree8e15fca5012b0e1bff123f568bbeb26a01190e2a /plugins/language_gdscript.lua
parent3b3253f8897c406ffb2d93d2b931df33c934d797 (diff)
downloadlite-xl-plugins-438d18e6db5107d865a68c7c42cb0c41859edba5.tar.gz
lite-xl-plugins-438d18e6db5107d865a68c7c42cb0c41859edba5.zip
Create language_gdscript.lua
Diffstat (limited to 'plugins/language_gdscript.lua')
-rw-r--r--plugins/language_gdscript.lua99
1 files changed, 99 insertions, 0 deletions
diff --git a/plugins/language_gdscript.lua b/plugins/language_gdscript.lua
new file mode 100644
index 0000000..e301354
--- /dev/null
+++ b/plugins/language_gdscript.lua
@@ -0,0 +1,99 @@
+-- Support for the GDScript programming language: https://godotengine.org/
+-- Covers the most used keywords up to Godot version 3.2.x
+
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.gd$" },
+ comment = "#",
+ patterns = {
+ { pattern = "#.-\n", type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?0x%x*", type = "number" },
+ { pattern = "-?%d+[%d%.e]*", type = "number" },
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "[%+%:%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ -- keywords
+ ["if"] = "keyword",
+ ["elif"] = "keyword",
+ ["else"] = "keyword",
+ ["for"] = "keyword",
+ ["while"] = "keyword",
+ ["match"] = "keyword",
+ ["break"] = "keyword",
+ ["continue"] = "keyword",
+ ["pass"] = "keyword",
+ ["return"] = "keyword",
+ ["class"] = "keyword",
+ ["class_name"] = "keyword",
+ ["extends"] = "keyword",
+ ["is"] = "keyword",
+ ["in"] = "keyword",
+ ["as"] = "keyword",
+ ["and"] = "keyword",
+ ["or"] = "keyword",
+ ["not"] = "keyword",
+ ["self"] = "keyword",
+ ["tool"] = "keyword",
+ ["signal"] = "keyword",
+ ["func"] = "keyword",
+ ["static"] = "keyword",
+ ["const"] = "keyword",
+ ["enum"] = "keyword",
+ ["var"] = "keyword",
+ ["onready"] = "keyword",
+ ["export"] = "keyword",
+ ["setget"] = "keyword",
+ ["breakpoint"] = "keyword",
+ ["preload"] = "keyword",
+ ["yield"] = "keyword",
+ ["assert"] = "keyword",
+ ["remote"] = "keyword",
+ ["master"] = "keyword",
+ ["puppet"] = "keyword",
+ ["remotesync"] = "keyword",
+ ["mastersync"] = "keyword",
+ ["puppetsync"] = "keyword",
+ -- types
+ ["void"] = "keyword2",
+ ["int"] = "keyword2",
+ ["float"] = "keyword2",
+ ["bool"] = "keyword2",
+ ["String"] = "keyword2",
+ ["Vector2"] = "keyword2",
+ ["Rect2"] = "keyword2",
+ ["Vector3"] = "keyword2",
+ ["Transform2D"] = "keyword2",
+ ["Plane"] = "keyword2",
+ ["Quat"] = "keyword2",
+ ["AABB"] = "keyword2",
+ ["Basis"] = "keyword2",
+ ["Transform"] = "keyword2",
+ ["Color"] = "keyword2",
+ ["NodePath"] = "keyword2",
+ ["RID"] = "keyword2",
+ ["Object"] = "keyword2",
+ ["Array"] = "keyword2",
+ ["PoolByteArray"] = "keyword2",
+ ["PoolIntArray"] = "keyword2",
+ ["PoolRealArray"] = "keyword2",
+ ["PoolStringArray"] = "keyword2",
+ ["PoolVector2Array"] = "keyword2",
+ ["PoolVector3Array"] = "keyword2",
+ ["PoolColorArray"] = "keyword2",
+ ["Dictionary"] = "keyword2",
+ -- literals
+ ["null"] = "literal",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["PI"] = "literal",
+ ["TAU"] = "literal",
+ ["INF"] = "literal",
+ ["NAN"] = "literal",
+ },
+}