added syntax for main languages

master
Alessandro Mauri 3 years ago
parent c08fbb0840
commit dda5abb8e9
  1. 61
      data/plugins/language_batch.lua
  2. 15
      data/plugins/language_cmake.lua
  3. 14
      data/plugins/language_comment.lua
  4. 121
      data/plugins/language_cpp.lua
  5. 120
      data/plugins/language_csharp.lua
  6. 135
      data/plugins/language_d.lua
  7. 62
      data/plugins/language_dart.lua
  8. 92
      data/plugins/language_elixir.lua
  9. 99
      data/plugins/language_gdscript.lua
  10. 387
      data/plugins/language_glsl.lua
  11. 72
      data/plugins/language_go.lua
  12. 275
      data/plugins/language_hlsl.lua
  13. 45
      data/plugins/language_hs.lua
  14. 75
      data/plugins/language_java.lua
  15. 35
      data/plugins/language_meson.lua
  16. 120
      data/plugins/language_nim.lua
  17. 61
      data/plugins/language_objc.lua
  18. 99
      data/plugins/language_php.lua
  19. 51
      data/plugins/language_pico8.lua
  20. 72
      data/plugins/language_powershell.lua
  21. 90
      data/plugins/language_psql.lua
  22. 86
      data/plugins/language_rust.lua
  23. 42
      data/plugins/language_sh.lua
  24. 16
      data/plugins/language_tex.lua

@ -0,0 +1,61 @@
local syntax = require "core.syntax"
-- batch syntax for lite <liqube>
-- windows batch files use caseless matching for symbols
local symtable = {
["keyword"] = {
"if", "else", "elsif", "not", "for", "do", "in",
"equ", "neq", "lss", "leq", "gtr", "geq", -- == != < <= > >=
"nul", "con", "prn", "prn", "lpt1", "com1", "com2", "com3", "com4",
"exist", "defined",
"errorlevel", "cmdextversion",
"goto", "call", "verify",
},
["function"] = {
"set", "setlocal", "endlocal", "enabledelayedexpansion",
"echo", "type",
"cd", "chdir",
"md", "mkdir",
"pause", "choice", "exit",
"del", "rd", "rmdir",
"copy", "xcopy",
"move", "ren",
"find", "findstr",
"sort", "shift", "attrib",
"cmd", "command",
"forfiles",
},
}
-- prepare a mixed symbol list
local function prepare_symbols(symtable)
local symbols = { }
for symtype, symlist in pairs(symtable) do
for _, symname in ipairs(symlist) do
symbols[symname:lower()] = symtype
symbols[symname:upper()] = symtype
end
end
return symbols
end
syntax.add {
files = { "%.bat$", "%.cmd$" },
comment = "rem",
patterns = {
{ pattern = "@echo off\n", type = "keyword" },
{ pattern = "@echo on\n", type = "keyword" },
{ pattern = "rem.-\n", type = "comment" }, -- rem comment line, rem, rem.
{ pattern = "REM.-\n", type = "comment" },
{ pattern = "%s*:[%w%-]+", type = "symbol" }, -- :labels
{ pattern = "%:%:.-\n", type = "comment" }, -- :: comment line
{ pattern = "%%%w+%%", type = "symbol" }, -- %variable%
{ pattern = "%%%%?~?[%w:]+", type = "symbol" }, -- %1, %~dpn1, %~1:2, %%i, %%~i
{ pattern = "[!=()%>&%^/\\@]", type = "operator" }, -- operators
{ pattern = "-?%.?%d+f?", type = "number" }, -- integer numbers
{ pattern = { '"', '"', '\\' }, type = "string" }, -- "strings"
{ pattern = "[%a_][%w_]*", type = "normal" },
{ pattern = ":eof", type = "keyword" }, -- not quite as intended, but ok for now
},
symbols = prepare_symbols(symtable),
}

@ -0,0 +1,15 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.cmake$", "CMakeLists.txt$" },
comment = "//",
patterns = {
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "normal" },
{ pattern = "%${[%a_][%w_]*%}", type = "operator" },
},
symbols = {},
}

@ -0,0 +1,14 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.%$" },
patterns = {},
symbols = {
["TODO"] = "keyword",
["FIXME"] = "keyword",
["FIX"] = "keyword",
["BUG"] = "keyword",
["IMPROVEMENT"] = "keyword",
},
}

@ -0,0 +1,121 @@
pcall(require, "plugins.language_c")
local syntax = require "core.syntax"
syntax.add {
files = {
"%.h$", "%.inl$", "%.cpp$", "%.cc$", "%.C$", "%.cxx$",
"%.c++$", "%.hh$", "%.H$", "%.hxx$", "%.hpp$", "%.h++$"
},
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ 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" },
},
symbols = {
["alignof"] = "keyword",
["alignas"] = "keyword",
["and"] = "keyword",
["and_eq"] = "keyword",
["not"] = "keyword",
["not_eq"] = "keyword",
["or"] = "keyword",
["or_eq"] = "keyword",
["xor"] = "keyword",
["xor_eq"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["register"] = "keyword",
["nullptr"] = "keyword",
["operator"] = "keyword",
["asm"] = "keyword",
["bitand"] = "keyword",
["bitor"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["class"] = "keyword",
["compl"] = "keyword",
["explicit"] = "keyword",
["export"] = "keyword",
["concept"] = "keyword",
["consteval"] = "keyword",
["constexpr"] = "keyword",
["constinit"] = "keyword",
["const_cast"] = "keyword",
["dynamic_cast"] = "keyword",
["reinterpret_cast"] = "keyword",
["static_cast"] = "keyword",
["static_assert"] = "keyword",
["template"] = "keyword",
["this"] = "keyword",
["thread_local"] = "keyword",
["requires"] = "keyword",
["co_wait"] = "keyword",
["co_return"] = "keyword",
["co_yield"] = "keyword",
["decltype"] = "keyword",
["delete"] = "keyword",
["export"] = "keyword",
["friend"] = "keyword",
["typeid"] = "keyword",
["typename"] = "keyword",
["mutable"] = "keyword",
["virtual"] = "keyword",
["using"] = "keyword",
["namespace"] = "keyword",
["new"] = "keyword",
["noexcept"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["const"] = "keyword",
["inline"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["auto"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["int"] = "keyword2",
["short"] = "keyword2",
["long"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["unsigned"] = "keyword2",
["bool"] = "keyword2",
["true"] = "keyword2",
["false"] = "keyword2",
["wchar_t"] = "keyword2",
["char8_t"] = "keyword2",
["char16_t"] = "keyword2",
["char32_t"] = "keyword2",
["NULL"] = "literal",
},
}

@ -0,0 +1,120 @@
local syntax = require "core.syntax"
syntax.add {
files = "%.cs$",
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "[%$%@]?\"", '"', '\\' }, type = "string" }, -- string interpolation and verbatim
{ 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 = "%?%?", type = "operator" }, -- ?? null-coalescing
{ pattern = "%?%.", type = "operator" }, -- ?. null-conditional
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- keywords and contextual keywords
["abstract"] = "keyword",
["as"] = "keyword",
["add"] = "keyword",
["await"] = "keyword",
["base"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["checked"] = "keyword",
["class"] = "keyword",
["record"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["delegate"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["event"] = "keyword",
["explicit"] = "keyword",
["extern"] = "keyword",
["finally"] = "keyword",
["fixed"] = "keyword",
["for"] = "keyword",
["foreach"] = "keyword",
["get"] = "keyword",
["goto"] = "keyword",
["if"] = "keyword",
["implicit"] = "keyword",
["in"] = "keyword",
["interface"] = "keyword",
["internal"] = "keyword",
["is"] = "keyword",
["lock"] = "keyword",
["namespace"] = "keyword",
["new"] = "keyword",
["operator"] = "keyword",
["out"] = "keyword",
["override"] = "keyword",
["remove"] = "keyword",
["params"] = "keyword",
["partial"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["dynamic"] = "keyword",
["public"] = "keyword",
["readonly"] = "keyword",
["ref"] = "keyword",
["return"] = "keyword",
["sealed"] = "keyword",
["set"] = "keyword",
["sizeof"] = "keyword",
["stackalloc"] = "keyword",
["static"] = "keyword",
["struct"] = "keyword",
["switch"] = "keyword",
["this"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["typeof"] = "keyword",
["unchecked"] = "keyword",
["unsafe"] = "keyword",
["using"] = "keyword",
["var"] = "keyword",
["value"] = "keyword",
["global"] = "keyword",
["virtual"] = "keyword",
["void"] = "keyword",
["volatile"] = "keyword",
["where"] = "keyword",
["when"] = "keyword",
["while"] = "keyword",
["yield"] = "keyword",
-- types
["bool"] = "keyword2",
["byte"] = "keyword2",
["char"] = "keyword2",
["decimal"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["int"] = "keyword2",
["long"] = "keyword2",
["object"] = "keyword2",
["sbyte"] = "keyword2",
["short"] = "keyword2",
["string"] = "keyword2",
["uint"] = "keyword2",
["ulong"] = "keyword2",
["ushort"] = "keyword2",
-- literals
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}

@ -0,0 +1,135 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.d$", "%.di$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "/%+", "%+/" }, type = "comment" },
{ pattern = { '`', '`', '\\' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&%$]+", type = "operator" },
{ pattern = "[%a_][%w_]*!", type = "function" }, -- highlight templates
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "@safe", type = "keyword" },
{ pattern = "@trusted", type = "keyword" },
{ pattern = "@nogc", type = "keyword" },
},
symbols = {
["abstract"] = "keyword",
["alias"] = "keyword",
["align"] = "keyword",
["asm"] = "keyword",
["assert"] = "keyword",
["auto"] = "keyword",
["body"] = "keyword",
["bool"] = "keyword2",
["break"] = "keyword",
["byte"] = "keyword2",
["case"] = "keyword",
["cast"] = "keyword",
["catch"] = "keyword",
["cdouble"] = "keyword2",
["cent"] = "keyword2",
["cfloat"] = "keyword2",
["char"] = "keyword2",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["creal"] = "keyword2",
["dchar"] = "keyword2",
["debug"] = "keyword",
["default"] = "keyword",
["delegate"] = "keyword",
["deprecated"] = "keyword",
["do"] = "keyword",
["double"] = "keyword2",
["else"] = "keyword",
["enum"] = "keyword",
["export"] = "keyword",
["extern"] = "keyword",
["false"] = "literal",
["final"] = "keyword",
["finally"] = "keyword",
["float"] = "keyword2",
["for"] = "keyword",
["foreach"] = "keyword",
["foreach_reverse"] = "keyword",
["function"] = "keyword",
["goto"] = "keyword",
["idouble"] = "keyword2",
["if"] = "keyword",
["ifloat"] = "keyword2",
["immutable"] = "keyword",
["import"] = "keyword",
["in"] = "keyword",
["inout"] = "keyword",
["int"] = "keyword2",
["interface"] = "keyword",
["invariant"] = "keyword",
["ireal"] = "keyword2",
["is"] = "keyword",
["lazy"] = "keyword",
["long"] = "keyword2",
["macro"] = "keyword",
["mixin"] = "keyword",
["module"] = "keyword",
["new"] = "keyword",
["nothrow"] = "keyword",
["null"] = "literal",
["out"] = "keyword",
["override"] = "keyword",
["package"] = "keyword",
["pragma"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["pure"] = "keyword",
["real"] = "keyword2",
["ref"] = "keyword",
["return"] = "keyword",
["scope"] = "keyword",
["shared"] = "keyword",
["short"] = "keyword2",
["static"] = "keyword",
["struct"] = "keyword",
["super"] = "keyword",
["switch"] = "keyword",
["synchronized"] = "keyword",
["template"] = "keyword",
["this"] = "keyword",
["throw"] = "keyword",
["true"] = "literal",
["try"] = "keyword",
["typeid"] = "keyword",
["typeof"] = "keyword",
["ubyte"] = "keyword2",
["ucent"] = "keyword2",
["uint"] = "keyword2",
["ulong"] = "keyword2",
["union"] = "keyword",
["unittest"] = "keyword",
["ushort"] = "keyword2",
["version"] = "keyword",
["void"] = "keyword",
["wchar"] = "keyword2",
["while"] = "keyword",
["with"] = "keyword",
["__FILE__"] = "keyword",
["__FILE_FULL_PATH__"] = "keyword",
["__MODULE__"] = "keyword",
["__LINE__"] = "keyword",
["__FUNCTION__"] = "keyword",
["__PRETTY_FUNCTION__"] = "keyword",
["__gshared"] = "keyword",
["__traits"] = "keyword",
["__vector"] = "keyword",
["__parameters"] = "keyword",
},
}

@ -0,0 +1,62 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.dart$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = "///.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "%?%?", type = "operator" },
{ pattern = "%?%.", type = "operator" },
{ pattern = { "[%$%@]?\"", '"', '\\' }, type = "string" },
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["await"] = "keyword",
["bool"] = "keyword2",
["break"] = "keyword",
["case"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["do"] = "keyword",
["double"] = "keyword2",
["dynamic"] = "keyword2",
["else"] = "keyword",
["enum"] = "keyword",
["false"] = "literal",
["final"] = "keyword",
["finally"] = "keyword",
["for"] = "keyword",
["Function"] = "keyword2",
["if"] = "keyword",
["in"] = "keyword",
["int"] = "keyword2",
["List"] = "keyword2",
["Map"] = "keyword2",
["new"] = "keyword",
["null"] = "literal",
["part of"] = "keyword",
["print"] = "keyword",
["return"] = "keyword",
["static"] = "keyword",
["String"] = "keyword2",
["switch"] = "keyword",
["then"] = "keyword",
["this"] = "keyword2",
["true"] = "literal",
["void"] = "keyword",
["while"] = "keyword",
},
}

@ -0,0 +1,92 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.ex$", "%.exs$"},
comment = "#",
patterns = {
{ pattern = "#.*\n", type = "comment" },
{ pattern = { ':"', '"', '\\' }, type = "number" },
{ pattern = { '"""', '"""', '\\' }, type = "string" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '~%a[/"|\'%(%[%{<]', '[/"|\'%)%]%}>]', '\\' }, type = "string"},
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = ':"?[%a_][%w_]*"?', type = "number" },
{ pattern = "[%a][%w_!?]*%f[(]", type = "function" },
{ pattern = "%u%w+", type = "normal" },
{ pattern = "@[%a_][%w_]*", type = "keyword2" },
{ pattern = "_%a[%w_]*", type = "keyword2" },
{ pattern = "[%+%-=/%*<>!|&]", type = "operator" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["def"] = "keyword",
["defp"] = "keyword",
["defguard"] = "keyword",
["defguardp"] = "keyword",
["defmodule"] = "keyword",
["defprotocol"] = "keyword",
["defimpl"] = "keyword",
["defrecord"] = "keyword",
["defrecordp"] = "keyword",
["defmacro"] = "keyword",
["defmacrop"] = "keyword",
["defdelegate"] = "keyword",
["defoverridable"] = "keyword",
["defexception"] = "keyword",
["defcallback"] = "keyword",
["defstruct"] = "keyword",
["for"] = "keyword",
["case"] = "keyword",
["when"] = "keyword",
["with"] = "keyword",
["cond"] = "keyword",
["if"] = "keyword",
["unless"] = "keyword",
["try"] = "keyword",
["receive"] = "keyword",
["after"] = "keyword",
["raise"] = "keyword",
["rescue"] = "keyword",
["catch"] = "keyword",
["else"] = "keyword",
["quote"] = "keyword",
["unquote"] = "keyword",
["super"] = "keyword",
["unquote_splicing"] = "keyword",
["do"] = "keyword",
["end"] = "keyword",
["fn"] = "keyword",
["import"] = "keyword2",
["alias"] = "keyword2",
["use"] = "keyword2",
["require"] = "keyword2",
["and"] = "operator",
["or"] = "operator",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}
syntax.add {
files = { "%.l?eex$" },
patterns = {
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
{ pattern = { '<%%=?', '%%>' }, type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
{ pattern = "%f[^<][%a_][%w_]*", type = "function" },
{ pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
{ pattern = "[%a_][%w_]*", type = "keyword" },
{ pattern = "[/<>=]", type = "operator" },
},
symbols = {},
}

@ -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",
},
}

@ -0,0 +1,387 @@
local style = require "core.style"
local common = require "core.common"
local syntax = require "core.syntax"
syntax.add {
files = { "%.glsl$", "%.frag$", "%.vert$", },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "ivec[2-4]", type = "keyword2" },
{ pattern = "bvec[2-4]", type = "keyword2" },
{ pattern = "uvec[2-4]", type = "keyword2" },
{ pattern = "vec[2-4]", type = "keyword2" },
{ pattern = "dmat[2-4]x[2-4]", type = "keyword2" },
{ pattern = "dmat[2-4]", type = "keyword2" },
{ pattern = "mat[2-4]x[2-4]", type = "keyword2" },
{ pattern = "mat[2-4]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
--https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
--The symbols are added here in the order they appear in the spec
["if"] = "keyword",
["else"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["const"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["bool"] = "keyword2",
["int"] = "keyword2",
["uint"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["attribute"] = "keyword",
["varying"] = "keyword",
["uniform"] = "keyword",
["buffer"] = "keyword",
["shared"] = "keyword",
["layout"] = "keyword",
["centroid"] = "keyword",
["flat"] = "keyword",
["smooth"] = "keyword",
["noperspective"]= "keyword",
["patch"] = "keyword",
["sample"] = "keyword",
["in"] = "keyword",
["out"] = "keyword",
["inout"] = "keyword",
["invariant"] = "keyword",
["precise"] = "keyword",
["lowp"] = "keyword",
["mediump"] = "keyword",
["highp"] = "keyword",
["precision"] = "keyword",
["struct"] = "keyword",
["subroutine"] = "keyword",
["coherent"] = "keyword",
["volatile"] = "keyword",
["readonly"] = "keyword",
["writeonly"] = "keyword",
["sampler1D"] = "keyword2",
["sampler2D"] = "keyword2",
["sampler3D"] = "keyword2",
["samplerCube"] = "keyword2",
["sampler1DShadow"] = "keyword2",
["sampler2DShadow"] = "keyword2",
["samplerCubeShadow"] = "keyword2",
["sampler1DArray"] = "keyword2",
["sampler2DArray"] = "keyword2",
["samplerCubeArray"] = "keyword2",
["sampler1DArrayShadow"] = "keyword2",
["sampler2DArrayShadow"] = "keyword2",
["samplerCubeArrayShadow"]= "keyword2",
["isampler1D"] = "keyword2",
["isampler2D"] = "keyword2",
["isampler3D"] = "keyword2",
["isamplerCube"] = "keyword2",
["sampler2DMS"] = "keyword2",
["isampler2DMS"] = "keyword2",
["usampler2DMS"] = "keyword2",
["sampler2DMSArray"] = "keyword2",
["isampler2DMSArray"] = "keyword2",
["usampler2DMSArray"] = "keyword2",
["isampler1DArray"] = "keyword2",
["isampler2DArray"] = "keyword2",
["usampler1D"] = "keyword2",
["usampler2D"] = "keyword2",
["usampler3D"] = "keyword2",
["usamplerCube"] = "keyword2",
["usampler1DArray"] = "keyword2",
["usampler2DArray"] = "keyword2",
["sampler2DRect"] = "keyword2",
["sampler2DRectShadow"] = "keyword2",
["isampler2DRect"] = "keyword2",
["usampler2DRect"] = "keyword2",
["samplerBuffer"] = "keyword2",
["isamplerBuffer"] = "keyword2",
["usamplerBuffer"] = "keyword2",
["image1D"] = "keyword2",
["iimage1D"] = "keyword2",
["uimage1D"] = "keyword2",
["image1DArray"] = "keyword2",
["iimage1DArray"] = "keyword2",
["uimage1DArray"] = "keyword2",
["image2D"] = "keyword2",
["iimage2D"] = "keyword2",
["uimage2D"] = "keyword2",
["image2DArray"] = "keyword2",
["iimage2DArray"] = "keyword2",
["uimage2DArray"] = "keyword2",
["image2DRect"] = "keyword2",
["iimage2DRect"] = "keyword2",
["uimage2DRect"] = "keyword2",
["image2DMS"] = "keyword2",
["iimage2DMS"] = "keyword2",
["uimage2DMS"] = "keyword2",
["image2DMSArray"] = "keyword2",
["iimage2DMSArray"]= "keyword2",
["uimage2DMSArray"]= "keyword2",
["image3D"] = "keyword2",
["iimage3D"] = "keyword2",
["uimage3D"] = "keyword2",
["imageCube"] = "keyword2",
["iimageCube"] = "keyword2",
["uimageCube"] = "keyword2",
["imageCubeArray"] = "keyword2",
["iimageCubeArray"]= "keyword2",
["uimageCubeArray"]= "keyword2",
["imageBuffer"] = "keyword2",
["iimageBuffer"] = "keyword2",
["uimageBuffer"] = "keyword2",
["atomic_uint"] = "keyword2",
["radians"] = "keyword",
["degrees"] = "keyword",
["sin"] = "keyword",
["cos"] = "keyword",
["tan"] = "keyword",
["asin"] = "keyword",
["acos"] = "keyword",
["atan"] = "keyword",
["sinh"] = "keyword",
["cosh"] = "keyword",
["tanh"] = "keyword",
["asinh"] = "keyword",
["acosh"] = "keyword",
["pow"] = "keyword",
["exp"] = "keyword",
["exp2"] = "keyword",
["log2"] = "keyword",
["sqrt"] = "keyword",
["inversesqrt"] = "keyword",
["abs"] = "keyword",
["sign"] = "keyword",
["floor"] = "keyword",
["trunc"] = "keyword",
["round"] = "keyword",
["roundEven"] = "keyword",
["ceil"] = "keyword",
["fract"] = "keyword",
["mod"] = "keyword",
["modf"] = "keyword",
["min"] = "keyword",
["max"] = "keyword",
["clamp"] = "keyword",
["mix"] = "keyword",
["step"] = "keyword",
["smoothstep"] = "keyword",
["isnan"] = "keyword",
["isinf"] = "keyword",
["floatBitsToInt"] = "keyword",
["floatBitsToUint"] = "keyword",
["intBitsToFloat"] = "keyword",
["uintBitsToFloat"] = "keyword",
["fma"] = "keyword",
["frexp"] = "keyword",
["ldexp"] = "keyword",
["packUnorm2x16"] = "keyword",
["packSnorm2x16"] = "keyword",
["packUnorm4x8"] = "keyword",
["packSnorm4x8"] = "keyword",
["unpackUnorm2x16"] = "keyword",
["unpackSnorm2x16"] = "keyword",
["unpackUnorm4x8"] = "keyword",
["unpackSnorm4x8"] = "keyword",
["packHalf2x16"] = "keyword",
["unpackHalf2x16"] = "keyword",
["packDouble2x32"] = "keyword",
["unpackDouble2x32"] = "keyword",
["length"] = "keyword",
["distance"] = "keyword",
["dot"] = "keyword",
["cross"] = "keyword",
["normalize"] = "keyword",
["ftransform"] = "keyword",
["faceforward"] = "keyword",
["reflect"] = "keyword",
["refract"] = "keyword",
["matrixCompMult"] = "keyword",
["outerProduct"] = "keyword",
["transpose"] = "keyword",
["determinant"] = "keyword",
["inverse"] = "keyword",
["lessThan"] = "keyword",
["lessThanEqual"] = "keyword",
["greaterThan"] = "keyword",
["greaterThanEqual"] = "keyword",
["equal"] = "keyword",
["notEqual"] = "keyword",
["any"] = "keyword",
["all"] = "keyword",
["not"] = "keyword",
["uaddCarry"] = "keyword",
["usubBorrow"] = "keyword",
["umulExtended"] = "keyword",
["imulExtended"] = "keyword",
["bitfieldExtract"] = "keyword",
["bitfieldInsert"] = "keyword",
["bitfieldReverse"] = "keyword",
["bitCount"] = "keyword",
["findLSB"] = "keyword",
["findMSB"] = "keyword",
["textureSize"] = "keyword",
["textureQueryLod"] = "keyword",
["textureQueryLevels"] = "keyword",
["textureSamples"] = "keyword",
["texture"] = "keyword",
["textureProj"] = "keyword",
["textureLod"] = "keyword",
["textureOffset"] = "keyword",
["texelFetch"] = "keyword",
["texelFetchOffset"] = "keyword",
["textureProjOffset"] = "keyword",
["textureLodOffset"] = "keyword",
["textureProjLod"] = "keyword",
["textureProjLodOffset"] = "keyword",
["textureGrad"] = "keyword",
["textureGradOffset"] = "keyword",
["textureProjGrad"] = "keyword",
["textureProjGradOffset"]= "keyword",
["textureGather"] = "keyword",
["textureGatherOffset"] = "keyword",
["textureGatherOffsets"] = "keyword",
--Atomic Counter Functions
["atomicCounterIncrement"]= "keyword",
["atomicCounterDecrement"]= "keyword",
["atomicCounter"] = "keyword",
["atomicCounterAdd"] = "keyword",
["atomicCounterSubtract"] = "keyword",
["atomicCounterMin"] = "keyword",
["atomicCounterMax"] = "keyword",
["atomicCounterAnd"] = "keyword",
["atomicCounterOr"] = "keyword",
["atomicCounterXor"] = "keyword",
["atomicCounterExchange"] = "keyword",
["atomicCounterCompSwap"] = "keyword",
--Atomic Memory Functions
["atomicAdd"] = "keyword",
["atomicMin"] = "keyword",
["atomicMax"] = "keyword",
["atomicAnd"] = "keyword",
["atomicOr"] = "keyword",
["atomicXor"] = "keyword",
["atomicExchange"]= "keyword",
["atomicCompSwap"]= "keyword",
--Image Functions
["imageSize"] = "keyword",
["imageSamples"] = "keyword",
["imageLoad"] = "keyword",
["imageStore"] = "keyword",
["imageAtomicAdd"] = "keyword",
["imageAtomicMin"] = "keyword",
["imageAtomicMax"] = "keyword",
["imageAtomicAnd"] = "keyword",
["imageAtomicOr"] = "keyword",
["imageAtomicXor"] = "keyword",
["imageAtomicExchange"]= "keyword",
["imageAtomicCompSwap"]= "keyword",
--Geometry Shader Functions
["EmitStreamVertex"] = "keyword",
["EndStreamPrimitive"] = "keyword",
["EmitVertex"] = "keyword",
["EndPrimitive"] = "keyword",
--Fragment Processing Functions
["dFdx"] = "keyword",
["dFdy"] = "keyword",
["dFdxFine"] = "keyword",
["dFdyFine"] = "keyword",
["dFdxCoarse"] = "keyword",
["dFdyCoarse"] = "keyword",
["fwidth"] = "keyword",
["fwidthFine"] = "keyword",
["fwidthCoarse"] = "keyword",
["interpolateAtCentroid"]= "keyword",
["interpolateAtSample"] = "keyword",
["interpolateAtOffset"] = "keyword",
--Shader Invocation Control Functions
["barrier"] = "keyword",
--Shader Memory Control Functions
["memoryBarrier"] = "keyword",
["memoryBarrierAtomicCounter"]= "keyword",
["memoryBarrierBuffer"] = "keyword",
["memoryBarrierShared"] = "keyword",
["memoryBarrierImage"] = "keyword",
["groupMemoryBarrier"] = "keyword",
--Subpass-Input Functions
["subpassLoad"] = "keyword",
--Shader Invocation Group Functions
["anyInvocation"] = "keyword",
["allInvocations"] = "keyword",
["allInvocationsEqual"]= "keyword",
--"In addition, when targeting Vulkan, the following keywords also exist:"
["texture1D"] = "keyword",
["texture1DArray"] = "keyword",
["itexture1D"] = "keyword",
["itexture1DArray"] = "keyword",
["utexture1D"] = "keyword",
["utexture1DArray"] = "keyword",
["texture2D"] = "keyword",
["texture2DArray"] = "keyword",
["itexture2D"] = "keyword",
["itexture2DArray"] = "keyword",
["utexture2D"] = "keyword",
["utexture2DArray"] = "keyword",
["texture2DRect"] = "keyword",
["itexture2DRect"] = "keyword",
["utexture2DRect"] = "keyword",
["texture2DMS"] = "keyword",
["itexture2DMS"] = "keyword",
["utexture2DMS"] = "keyword",
["texture2DMSArray"] = "keyword",
["itexture2DMSArray"]= "keyword",
["utexture2DMSArray"]= "keyword",
["texture3D"] = "keyword",
["itexture3D"] = "keyword",
["utexture3D"] = "keyword",
["textureCube"] = "keyword",
["itextureCube"] = "keyword",
["utextureCube"] = "keyword",
["textureCubeArray"] = "keyword",
["itextureCubeArray"]= "keyword",
["utextureCubeArray"]= "keyword",
["textureBuffer"] = "keyword",
["itextureBuffer"] = "keyword",
["utextureBuffer"] = "keyword",
["sampler"] = "keyword2",
["samplerShadow"] = "keyword2",
["subpassInput"] = "keyword2",
["isubpassInput"] = "keyword2",
["usubpassInput"] = "keyword2",
["subpassInputMS"] = "keyword2",
["isubpassInputMS"] = "keyword2",
["usubpassInputMS"] = "keyword2",
},
}

@ -0,0 +1,72 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.go$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = "0[oO_][0-7]+", type = "number" },
{ pattern = "-?0x[%x_]+", type = "number" },
{ pattern = "-?%d+_%d", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = ":=", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["for"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["struct"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["const"] = "keyword",
["package"] = "keyword",
["import"] = "keyword",
["func"] = "keyword",
["var"] = "keyword",
["type"] = "keyword",
["interface"] = "keyword",
["select"] = "keyword",
["break"] = "keyword",
["range"] = "keyword",
["chan"] = "keyword",
["defer"] = "keyword",
["go"] = "keyword",
["fallthrough"] = "keyword",
["int"] = "keyword2",
["int64"] = "keyword2",
["int32"] = "keyword2",
["int16"] = "keyword2",
["int8"] = "keyword2",
["uint"] = "keyword2",
["uint64"] = "keyword2",
["uint32"] = "keyword2",
["uint16"] = "keyword2",
["uint8"] = "keyword2",
["uintptr"] = "keyword2",
["float64"] = "keyword2",
["float32"] = "keyword2",
["map"] = "keyword2",
["string"] = "keyword2",
["rune"] = "keyword2",
["bool"] = "keyword2",
["byte"] = "keyword2",
["error"] = "keyword2",
["complex64"] = "keyword2",
["complex128"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}

@ -0,0 +1,275 @@
local style = require "core.style"
local common = require "core.common"
local syntax = require "core.syntax"
syntax.add {
files = { "%.hlsl$", },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "int[1-9]x[1-9]", type = "keyword2" },
{ pattern = "int1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "int[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "int1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "int[1-4]", type = "keyword2" },
{ pattern = "uint[1-9]x[1-9]", type = "keyword2" },
{ pattern = "uint1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "uint[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "uint1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "uint[1-4]", type = "keyword2" },
{ pattern = "dword[1-9]x[1-9]", type = "keyword2" },
{ pattern = "dword1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "dword[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "dword1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "dword[1-4]", type = "keyword2" },
{ pattern = "half[1-9]x[1-9]", type = "keyword2" },
{ pattern = "half1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "half[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "half1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "half[1-4]", type = "keyword2" },
{ pattern = "float[1-9]x[1-9]", type = "keyword2" },
{ pattern = "float1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "float[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "float1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "float[1-4]", type = "keyword2" },
{ pattern = "double[1-9]x[1-9]", type = "keyword2" },
{ pattern = "double1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "double[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "double1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "double[1-4]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-keywords
--The symbols are added in the order they appear on this webpage, which is alphabetically
["AppendStructuredBuffer"]= "keyword",
["asm"] = "keyword",
["asm_fragment"] = "keyword",
["BlendState"] = "keyword2",
["bool"] = "keyword2",
["break"] = "keyword",
["Buffer"] = "keyword2",
["ByteAddressBuffer"]= "keyword2",
["case"] = "keyword",
["cbuffer"] = "keyword2",
["centroid"] = "keyword2",
["class"] = "keyword",
["column_major"] = "keyword",
["compile"] = "keyword",
["compile_fragment"] = "keyword",
["CompileShader"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["ComputeShader"] = "keyword",
["ConsumeStructuredBuffer"]= "keyword",
["default"] = "keyword",
["DepthStencilState"]= "keyword",
["DepthStencilView"] = "keyword",
["discard"] = "keyword",
["do"] = "keyword",
["double"] = "keyword2",
["DomainShader"] = "keyword2",
["dword"] = "keyword2",
["else"] = "keyword",
["export"] = "keyword",
["extern"] = "keyword",
["false"] = "literal",
["float"] = "keyword2",
["for"] = "keyword",
["fxgroup"] = "keyword2",
["GeometryShader"] = "keyword2",
["groupshared"] = "keyword",
["half"] = "keyword2",
["HullShader"] = "keyword2",
["if"] = "keyword",
["in"] = "keyword",
["inline"] = "keyword",
["inout"] = "keyword",
["InputPatch"] = "keyword2",
["int"] = "keyword2",
["interface"] = "keyword",
["line"] = "keyword2",
["lineadj"] = "keyword2",
["linear"] = "keyword",
["LineStream"] = "keyword2",
["matrix"] = "keyword2",
["min16float"] = "keyword2",
["min10float"] = "keyword2",
["min16int"] = "keyword2",
["min12int"] = "keyword2",
["min16uint"] = "keyword2",
["namespace"] = "keyword",
["nointerpolation"] = "keyword",
["noperspective"] = "keyword",
["NULL"] = "literal",
["out"] = "keyword",
["OutputPatch"] = "keyword2",
["packoffset"] = "keyword",
["pass"] = "keyword",
["pixelfragment"] = "keyword",
["PixelShader"] = "keyword2",
["point"] = "keyword2",
["PointStream"] = "keyword2",
["precise"] = "keyword",
["RasterizerState"] = "keyword2",
["RenderTargetView"] = "keyword2",
["return"] = "keyword",
["register"] = "keyword",
["row_major"] = "keyword",
["RWBuffer"] = "keyword2",
["RWByteAddressBuffer"]= "keyword2",
["RWStructuredBuffer"]= "keyword2",
["RWTexture1D"] = "keyword2",
["RWTexture1DArray"] = "keyword2",
["RWTexture2D"] = "keyword2",
["RWTexture2DArray"] = "keyword2",
["RWTexture3D"] = "keyword2",
["sample"] = "keyword",
["sampler"] = "keyword2",
["SamplerState"] = "keyword2",
["SamplerComparisonState"]= "keyword2",
["shared"] = "keyword",
["snorm"] = "keyword",
["stateblock"] = "keyword",
["stateblock_state"] = "keyword",
["static"] = "keyword",
["string"] = "keyword2",
["struct"] = "keyword",
["switch"] = "keyword",
["StructuredBuffer"] = "keyword2",
["tbuffer"] = "keyword2",
["technique"] = "keyword2",
["technique10"] = "keyword2",
["technique11"] = "keyword2",
["texture"] = "keyword2",
["Texture1D"] = "keyword2",
["Texture1DArray"] = "keyword2",
["Texture2D"] = "keyword2",
["Texture2DArray"] = "keyword2",
["Texture2DMS"] = "keyword2",
["Texture2DMSArray"] = "keyword2",
["Texture3D"] = "keyword2",
["TextureCube"] = "keyword2",
["TextureCubeArray"] = "keyword2",
["true"] = "literal",
["typedef"] = "keyword",
["triangle"] = "keyword2",
["triangleadj"] = "keyword2",
["TriangleStream"] = "keyword2",
["uint"] = "keyword2",
["uniform"] = "keyword",
["unorm"] = "keyword",
["unsigned"] = "keyword",
["vector"] = "keyword2",
["vertexfragment"] = "keyword2",
["VertexShader"] = "keyword2",
["void"] = "keyword",
["volatile"] = "keyword",
["while"] = "keyword",
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-intrinsic-functions
--The symbols are added in the order they appear on this webpage, which is alphabetically
["abort"] = "keyword",
["abs"] = "keyword",
["acos"] = "keyword",
["all"] = "keyword",
["any"] = "keyword",
["asdouble"] = "keyword",
["asfloat"] = "keyword",
["asin"] = "keyword",
["asint"] = "keyword",
["asuint"] = "keyword",
["atan"] = "keyword",
["atan2"] = "keyword",
["ceil"] = "keyword",
["clamp"] = "keyword",
["clip"] = "keyword",
["cos"] = "keyword",
["cosh"] = "keyword",
["countbits"] = "keyword",
["cross"] = "keyword",
["ddx"] = "keyword",
["ddx_coarse"] = "keyword",
["ddx_fine"] = "keyword",
["ddy"] = "keyword",
["ddy_coarse"] = "keyword",
["ddy_fine"] = "keyword",
["degrees"] = "keyword",
["determinant"] = "keyword",
["distance"] = "keyword",
["dot"] = "keyword",
["dst"] = "keyword",
["errorf"] = "keyword",
["exp"] = "keyword",
["exp2"] = "keyword",
["f16tof32"] = "keyword",
["f32tof16"] = "keyword",
["faceforward"] = "keyword",
["firstbithigh"]= "keyword",
["firstbitlow"] = "keyword",
["floor"] = "keyword",
["fma"] = "keyword",
["fmod"] = "keyword",
["frac"] = "keyword",
["frexp"] = "keyword",
["fwidth"] = "keyword",
["isfinite"] = "keyword",
["isinf"] = "keyword",
["isnan"] = "keyword",
["ldexp"] = "keyword",
["length"] = "keyword",
["lerp"] = "keyword",
["lit"] = "keyword",
["log"] = "keyword",
["log10"] = "keyword",
["log2"] = "keyword",
["mad"] = "keyword",
["max"] = "keyword",
["min"] = "keyword",
["modf"] = "keyword",
["msad4"] = "keyword",
["mul"] = "keyword",
["noise"] = "keyword",
["normalize"] = "keyword",
["pow"] = "keyword",
["printf"] = "keyword",
["radians"] = "keyword",
["rcp"] = "keyword",
["reflect"] = "keyword",
["refract"] = "keyword",
["reversebits"] = "keyword",
["round"] = "keyword",
["rsqrt"] = "keyword",
["saturate"] = "keyword",
["sign"] = "keyword",
["sin"] = "keyword",
["sincos"] = "keyword",
["sinh"] = "keyword",
["smoothstep"] = "keyword",
["sqrt"] = "keyword",
["step"] = "keyword",
["tan"] = "keyword",
["tanh"] = "keyword",
["transpose"] = "keyword",
["trunc"] = "keyword",
},
}

@ -0,0 +1,45 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.hs$" },
comment = "%-%-",
patterns = {
{ pattern = {"%-%-", "\n"}, type = "comment" },
{ pattern = { "{%-", "%-}" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[!%#%$%%&*+./%<=>%?@\\%^|%-~:]", type = "operator" },
{ pattern = "[%a_'][%w_']*", type = "symbol" },
},
symbols = {
["as"] = "keyword",
["case"] = "keyword",
["of"] = "keyword",
["class"] = "keyword",
["data"] = "keyword",
["default"] = "keyword",
["deriving"] = "keyword",
["do"] = "keyword",
["forall"] = "keyword",
["foreign"] = "keyword",
["hiding"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["import"] = "keyword",
["infix"] = "keyword",
["infixl"] = "keyword",
["infixr"] = "keyword",
["let"] = "keyword",
["in"] = "keyword",
["mdo"] = "keyword",
["module"] = "keyword",
["newtype"] = "keyword",
["qualified"] = "keyword",
["type"] = "keyword",
["where"] = "keyword",
},
}

@ -0,0 +1,75 @@
local syntax = require "core.syntax"
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" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["else if"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["new"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["class"] = "keyword",
["implements"] = "keyword",
["extends"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["abstract"] = "keyword",
["interface"] = "keyword",
["assert"] = "keyword",
["import"] = "keyword",
["native"] = "keyword",
["package"] = "keyword",
["super"] = "keyword",
["synchronized"] = "keyword",
["instanceof"] = "keyword",
["enum"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["throws"] = "keyword",
["try"] = "keyword",
["transient"] = "keyword",
["finally"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["final"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["void"] = "keyword",
["int"] = "keyword2",
["short"] = "keyword2",
["byte"] = "keyword2",
["long"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["boolean"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}

@ -0,0 +1,35 @@
local syntax = require "core.syntax"
syntax.add {
files = "meson.build$",
comment = "#",
patterns = {
{ pattern = { "#", "\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "'''", "'''" }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+%d*", type = "number" },
{ pattern = "[%+%-=/%%%*!]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elif"] = "keyword",
["endif"] = "keyword",
["foreach"] = "keyword",
["endforeach"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["and"] = "keyword",
["not"] = "keyword",
["or"] = "keyword",
["in"] = "keyword",
["true"] = "literal",
["false"] = "literal",
},
}

@ -0,0 +1,120 @@
local syntax = require "core.syntax"
local patterns = {}
local symbols = {
["nil"] = "literal",
["true"] = "literal",
["false"] = "literal",
}
local number_patterns = {
"0[bB][01][01_]*",
"0o[0-7][0-7_]*",
"0[xX]%x[%x_]*",
"%d[%d_]*%.%d[%d_]*[eE][-+]?%d[%d_]*",
"%d[%d_]*%.%d[%d_]*",
"%d[%d_]*",
}
local type_suffix_patterns = {}
for _, size in ipairs({"", "8", "16", "32", "64"}) do
table.insert(type_suffix_patterns, "'?[fuiFUI]"..size)
end
for _, pattern in ipairs(number_patterns) do
for _, suffix in ipairs(type_suffix_patterns) do
table.insert(patterns, { pattern = pattern..suffix, type = "literal" })
end
table.insert(patterns, { pattern = pattern, type = "literal" })
end
local keywords = {
"addr", "and", "as", "asm",
"bind", "block", "break",
"case", "cast", "concept", "const", "continue", "converter",
"defer", "discard", "distinct", "div", "do",
"elif", "else", "end", "enum", "except", "export",
"finally", "for", "from", "func",
"if", "import", "in", "include", "interface", "is", "isnot", "iterator",
"let",
"macro", "method", "mixin", "mod",
"not", "notin",
"object", "of", "or", "out",
"proc", "ptr",
"raise", "ref", "return",
"shl", "shr", "static",
"template", "try", "tuple", "type",
"using",
"var",
"when", "while",
"xor",
"yield",
}
for _, keyword in ipairs(keywords) do
symbols[keyword] = "keyword"
end
local standard_types = {
"bool", "byte",
"int", "int8", "int16", "int32", "int64",
"uint", "uint8", "uint16", "uint32", "uint64",
"float", "float32", "float64",
"char", "string", "cstring",
"pointer",
"typedesc",
"void", "auto", "any",
"untyped", "typed",
"clong", "culong", "cchar", "cschar", "cshort", "cint", "csize", "csize_t",
"clonglong", "cfloat", "cdouble", "clongdouble", "cuchar", "cushort",
"cuint", "culonglong", "cstringArray",
}
for _, type in ipairs(standard_types) do
symbols[type] = "keyword2"
end
local standard_generic_types = {
"range",
"array", "open[aA]rray", "varargs", "seq", "set",
"sink", "lent", "owned",
}
for _, type in ipairs(standard_generic_types) do
table.insert(patterns, { pattern = type.."%f[%[]", type = "keyword2" })
table.insert(patterns, { pattern = type.." +%f[%w]", type = "keyword2" })
end
local user_patterns = {
-- comments
{ pattern = { "##?%[", "]##?" }, type = "comment" },
{ pattern = "##?.-\n", type = "comment" },
-- strings and chars
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { '"""', '"""[^"]' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "literal" },
-- function calls
{ pattern = "[a-zA-Z][a-zA-Z0-9_]*%f[(]", type = "function" },
-- identifiers
{ pattern = "[A-Z][a-zA-Z0-9_]*", type = "keyword2" },
{ pattern = "[a-zA-Z][a-zA-Z0-9_]*", type = "symbol" },
-- operators
{ pattern = "%.%f[^.]", type = "normal" },
{ pattern = ":%f[ ]", type = "normal" },
{ pattern = "[=+%-*/<>@$~&%%|!?%^&.:\\]+", type = "operator" },
}
for _, pattern in ipairs(user_patterns) do
table.insert(patterns, pattern)
end
local nim = {
files = { "%.nim$", "%.nims$", "%.nimble$" },
comment = "#",
patterns = patterns,
symbols = symbols,
}
syntax.add(nim)

@ -0,0 +1,61 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.m$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ 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 = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["const"] = "keyword",
["inline"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["auto"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["int"] = "keyword2",
["short"] = "keyword2",
["long"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["unsigned"] = "keyword2",
["bool"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["nil"] = "literal",
},
}

@ -0,0 +1,99 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.php$", "%.phtml" },
headers = "^<%?php",
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = "#.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
-- I dont know why the '//' are needed but I leave it here for now
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "%\\x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%.%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
-- To indicate variables.
{ pattern = "%$", type = "operator" },
},
symbols = {
["return"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["endif"] = "keyword",
["declare"] = "keyword",
["enddeclare"] = "keyword",
["switch"] = "keyword",
["endswitch"] = "keyword",
["as"] = "keyword",
["do"] = "keyword",
["for"] = "keyword",
["endfor"] = "keyword",
["foreach"] = "keyword",
["endforeach"] = "keyword",
["while"] = "keyword",
["endwhile"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["break"] = "keyword",
["exit"] = "keyword",
["goto"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["finally"] = "keyword",
["class"] = "keyword",
["trait"] = "keyword",
["interface"] = "keyword",
["public"] = "keyword",
["static"] = "keyword",
["protected"] = "keyword",
["private"] = "keyword",
["abstract"] = "keyword",
["final"] = "keyword",
["function"] = "keyword2",
["global"] = "keyword2",
["var"] = "keyword2",
["const"] = "keyword2",
["bool"] = "keyword2",
["boolean"] = "keyword2",
["int"] = "keyword2",
["integer"] = "keyword2",
["real"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["string"] = "keyword2",
["array"] = "keyword2",
["object"] = "keyword2",
["callable"] = "keyword2",
["iterable"] = "keyword2",
["namespace"] = "keyword2",
["extends"] = "keyword2",
["implements"] = "keyword2",
["instanceof"] = "keyword2",
["require"] = "keyword2",
["require_once"] = "keyword2",
["include"] = "keyword2",
["include_once"] = "keyword2",
["use"] = "keyword2",
["new"] = "keyword2",
["clone"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["parent"] = "literal",
["self"] = "literal",
},
}

@ -0,0 +1,51 @@
local syntax = require "core.syntax"
syntax.add {
files = "%.p8$",
headers = "^pico-8 cartridge",
comment = "--",
patterns = {
{ pattern = { 'pico%-8 cartridge', '__lua__' }, type = "comment" },
{ pattern = { '__gfx__\n', '%z' }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>~=&|]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "::[%a_][%w_]*::", type = "function" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["end"] = "keyword",
["do"] = "keyword",
["function"] = "keyword",
["repeat"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["return"] = "keyword",
["local"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["goto"] = "keyword",
["self"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}

@ -0,0 +1,72 @@
local syntax = require "core.syntax"
syntax.add {
files = {"%.ps1$", "%.psm1$", "%.psd1$", "%.ps1xml$", "%.pssc$", "%.psrc$", "%.cdxml$"},
comment = "#",
patterns = {
{pattern = "#.*\n", type = "comment"},
{pattern = [[\.]], type = "normal"},
{pattern = {'"', '"'}, type = "string"},
{pattern = {"'", "'"}, type = "string"},
{pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number"},
{pattern = "[%+=/%*%^%%<>!~|&,:]+", type = "operator"},
{pattern = "%f[%S]%-[%w%-_]+", type = "function"},
{pattern = "[%u][%a]+[%-][%u][%a]+", type = "function"},
{pattern = "${.*}", type = "symbol"},
{pattern = "$[%a_@*][%w_]*", type = "keyword2"},
{pattern = "$[%$][%a]+", type = "keyword2"},
{pattern = "[%a_][%w_]*", type = "symbol"}
},
symbols = {
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["switch"] = "keyword",
["default"] = "keyword",
["function"] = "keyword",
["filter"] = "keyword",
["workflow"] = "keyword",
["configuration"] = "keyword",
["class"] = "keyword",
["enum"] = "keyword",
["Parameter"] = "keyword",
["ValidateScript"] = "keyword",
["CmdletBinding"] = "keyword",
["try"] = "keyword",
["catch"] = "keyword",
["finally"] = "keyword",
["throw"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["do"] = "keyword",
["until"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["foreach"] = "keyword",
["in"] = "keyword",
["return"] = "keyword",
["where"] = "function",
["select"] = "function",
["filter"] = "keyword",
["in"] = "keyword",
["trap"] = "keyword",
["param"] = "keyword",
["data"] = "keyword",
["dynamicparam"] = "keyword",
["begin"] = "function",
["process"] = "function",
["end"] = "function",
["exit"] = "function",
["inlinescript"] = "function",
["parallel"] = "function",
["sequence"] = "function",
["true"] = "literal",
["false"] = "literal",
["TODO"] = "comment",
["FIXME"] = "comment",
["XXX"] = "comment",
["TBD"] = "comment",
["HACK"] = "comment",
["NOTE"] = "comment"
}
}

@ -0,0 +1,90 @@
local syntax = require "core.syntax"
-- In sql symbols can be lower case and upper case
local keywords = {
"CREATE", "SELECT", "INSERT", "INTO", "UPDATE",
"DELETE", "TABLE", "DROP", "VALUES", "NOT",
"NULL", "PRIMARY", "KEY", "REFERENCES",
"DEFAULT", "UNIQUE", "CONSTRAINT", "CHECK",
"ON", "EXCLUDE", "WITH", "USING", "WHERE",
"GROUP", "BY", "HAVING", "DISTINCT", "LIMIT",
"OFFSET", "ONLY", "CROSS", "JOIN", "INNER",
"LEFT", "RIGHT", "FULL", "OUTER", "NATURAL",
"AND", "OR", "AS", "ORDER", "ORDINALITY",
"UNNEST", "FROM", "VIEW", "RETURNS", "SETOF",
"LANGUAGE", "SQL", "LIKE", "LATERAL",
"INTERVAL", "PARTITION", "UNION", "INTERSECT",
"EXCEPT", "ALL", "ASC", "DESC", "NULLS",
"FIRST", "LAST", "IN", "RECURSIVE", "ARRAY",
"RETURNING", "SET", "ALSO", "INSTEAD",
"ALTER", "SEQUENCE", "OWNED", "AT", "ZONE",
"WITHOUT", "TO", "TIMEZONE", "TYPE", "ENUM",
"DOCUMENT", "XMLPARSE", "XMLSERIALIZE",
"CONTENT", "OPTION", "INDEX", "ANY",
"EXTENSION", "ISNULL", "NOTNULL", "UNKNOWN",
"CASE", "THEN", "WHEN", "ELSE", "END",
"ROWS", "BETWEEN", "UNBOUNDED", "PRECEDING",
"UNBOUNDED", "FOLLOWING", "EXISTS", "SOME",
"COLLATION", "FOR", "TRIGGER", "BEFORE",
"EACH", "ROW", "EXECUTE", "PROCEDURE",
"FUNCTION", "DECLARE", "BEGIN", "LOOP",
"RAISE", "NOTICE", "LOOP", "EVENT",
"OPERATOR", "DOMAIN", "VARIADIC", "FOREIGN"
}
local types = {
"BIGINT", "INT8", "BIGSERIAL", "SERIAL8",
"BIT", "VARBIT", "BOOLEAN", "BOOL", "BOX",
"BYTEA", "CHARACTER", "CHAR", "VARCHAR",
"CIDR", "CIRCLE", "DATE", "DOUBLE",
"PRECISION", "FLOAT8", "INET", "INTEGER",
"INT", "INT4", "INTERVAL", "JSON", "JSONB",
"LINE", "LSEG", "MACADDR", "MONEY", "NUMERIC",
"DECIMAL", "PATH", "POINT", "POLYGON", "REAL",
"FLOAT4", "INT2", "SMALLINT", "SMALLSERIAL",
"SERIAL2", "SERIAL", "SERIAL4", "TEXT",
"TIME", "TIMEZ", "TIMESTAMP", "TIMESTAMPZ",
"TSQUERY", "TSVECTOR", "TXID_SNAPSHOT",
"UUID", "XML", "INT4RANGE", "INT8RANGE",
"NUMRANGE", "TSRANGE", "TSTZRANGE",
"DATERANGE", "PG_LSN"
}
local literals = {
"FALSE", "TRUE", "CURRENT_TIMESTAMP",
"CURRENT_TIME", "CURRENT_DATE", "LOCALTIME",
"LOCALTIMESTAMP"
}
local symbols = {}
for _, keyword in ipairs(keywords) do
symbols[keyword:lower()] = "keyword"
symbols[keyword] = "keyword"
end
for _, type in ipairs(types) do
symbols[type:lower()] = "keyword2"
symbols[type] = "keyword2"
end
for _, literal in ipairs(literals) do
symbols[literal:lower()] = "literal"
symbols[literal] = "literal"
end
syntax.add {
files = { "%.sql$", "%.psql$" },
comment = "--",
patterns = {
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ 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" },
},
symbols = symbols,
}

@ -0,0 +1,86 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.rs$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = "0[oO_][0-7]+", type = "number" },
{ pattern = "-?0x[%x_]+", type = "number" },
{ pattern = "-?%d+_%d", 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" },
},
symbols = {
["as"] = "keyword",
["async"] = "keyword",
["await"] = "keyword",
["break"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["crate"] = "keyword",
["dyn"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["false"] = "keyword",
["fn"] = "keyword",
["for"] = "keyword",
["if"] = "keyword",
["impl"] = "keyword",
["in"] = "keyword",
["let"] = "keyword",
["loop"] = "keyword",
["match"] = "keyword",
["mod"] = "keyword",
["move"] = "keyword",
["mut"] = "keyword",
["pub"] = "keyword",
["ref"] = "keyword",
["return"] = "keyword",
["Self"] = "keyword",
["self"] = "keyword",
["static"] = "keyword",
["struct"] = "keyword",
["super"] = "keyword",
["trait"] = "keyword",
["true"] = "keyword",
["type"] = "keyword",
["unsafe"] = "keyword",
["use"] = "keyword",
["where"] = "keyword",
["while"] = "keyword",
["i32"] = "keyword2",
["i64"] = "keyword2",
["i128"] = "keyword2",
["i16"] = "keyword2",
["i8"] = "keyword2",
["u8"] = "keyword2",
["u16"] = "keyword2",
["u32"] = "keyword2",
["u64"] = "keyword2",
["usize"] = "keyword2",
["isize"] = "keyword2",
["f32"] = "keyword2",
["f64"] = "keyword2",
["f128"] = "keyword2",
["String"] = "keyword2",
["char"] = "keyword2",
["&str"] = "keyword2",
["bool"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["None"] = "literal",
["Some"] = "literal",
["Option"] = "literal",
["Result"] = "literal",
},
}

@ -0,0 +1,42 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.sh$" },
headers = "^#!.*bin.*sh\n",
comment = "#",
patterns = {
{ pattern = "#.*\n", type = "comment" },
{ pattern = [[\.]], type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { '`', '`', '\\' }, type = "string" },
{ pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
{ pattern = "[!<>|&%[%]=*]", type = "operator" },
{ pattern = "%f[%S]%-[%w%-_]+", type = "function" },
{ pattern = "${.*}", type = "keyword2" },
{ pattern = "$[%a_@*][%w_]*", type = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["case"] = "keyword",
["do"] = "keyword",
["done"] = "keyword",
["elif"] = "keyword",
["else"] = "keyword",
["esac"] = "keyword",
["fi"] = "keyword",
["for"] = "keyword",
["function"] = "keyword",
["if"] = "keyword",
["in"] = "keyword",
["select"] = "keyword",
["then"] = "keyword",
["time"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["echo"] = "keyword",
["true"] = "literal",
["false"] = "literal",
},
}

@ -0,0 +1,16 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.tex$" },
comment = "%%",
patterns = {
{ pattern = {"%%", "\n"}, type = "comment" },
{ pattern = "&", type = "operator" },
{ pattern = "\\\\", type = "operator" },
{ pattern = {"%$", "%$"}, type = "operator" },
{ pattern = {"\\%[", "\\]"}, type = "operator" },
{ pattern = {"{", "}"}, type = "keyword" },
{ pattern = "\\%w*", type = "keyword2" },
},
symbols = {}
}
Loading…
Cancel
Save