lite-xl/resources/amiga/addons/plugins/language_hws.lua

124 lines
4.3 KiB
Lua
Raw Permalink Normal View History

2023-12-18 18:53:40 +01:00
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Hollywood",
files = { "%.hws$" },
comment = ";",
block_comment = {"/*", "*/"},
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "#[A-Z_]*", type = "keyword2" },
{ pattern = "@[A-Z_]*", type = "keyword" },
{ pattern = ";.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
-- Respect control structures, treat as keyword not function
{ pattern = "Block[ \t\n]", type = "keyword"},
{ pattern = "Break[ \t\n]", type = "keyword"},
{ pattern = "Case[ \t]", type = "keyword"},
{ pattern = "Const[ \t]", type = "keyword"},
{ pattern = "Continue[ \t]", type = "keyword"},
{ pattern = "Default[ \t\n]", type = "keyword"},
{ pattern = "Dim[ \t]", type = "keyword"},
{ pattern = "DimStr[ \t]", type = "keyword"},
{ pattern = "Do[ \t]", type = "keyword"},
{ pattern = "Else[ \t\n]", type = "keyword"},
{ pattern = "EndBlock[ \t\n]", type = "keyword"},
{ pattern = "EndFunction[ \t\n]", type = "keyword"},
{ pattern = "EndIf[ \t\n]", type = "keyword"},
{ pattern = "EndSwitch[ \t\n]", type = "keyword"},
{ pattern = "FallThrough[ \t]", type = "keyword"},
{ pattern = "False", type = "literal"},
{ pattern = "For[ \t]", type = "keyword"},
{ pattern = "Forever[ \t\n]", type = "keyword"},
{ pattern = "Function[ \t]", type = "keyword"},
{ pattern = "Global[ \t]", type = "keyword"},
{ pattern = "Gosub[ \t]", type = "keyword"},
{ pattern = "Goto[ \t]", type = "keyword"},
{ pattern = "If[ \t]", type = "keyword"},
{ pattern = "In[ \t]", type = "keyword"},
{ pattern = "Label[ \t]", type = "keyword"},
{ pattern = "Local[ \t]", type = "keyword"},
{ pattern = "Next[ \t\n]", type = "keyword"},
{ pattern = "Nil", type = "literal"},
{ pattern = "Repeat[ \t\n]", type = "keyword"},
{ pattern = "Return[ \t]", type = "keyword"},
{ pattern = "Step[ \t]", type = "keyword"},
{ pattern = "Switch[ \t]", type = "keyword"},
{ pattern = "Then[ \t]", type = "keyword"},
{ pattern = "To[ \t]", type = "keyword"},
{ pattern = "True", type = "literal"},
{ pattern = "Until[ \t]", type = "keyword"},
{ pattern = "Wend", type = "keyword"},
{ pattern = "While[ \t]", type = "keyword"},
{ pattern = "[%a_][%w_]*[%s]*%f[(]", type = "function" },
{ pattern = "[%+%-=/\\%*%^%%<>!~|&]", type = "operator" },
{ pattern = "0[bB][%d]+", type = "number" },
{ pattern = "0[xX][%da-fA-F]+", type = "number" },
{ pattern = "$[%d]+", type = "number" },
{ pattern = "-?%d[%d_%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" }
},
symbols = {
["Block"] = "keyword",
["Break"] = "keyword",
["Case"] = "keyword",
["Const"] = "keyword",
["Continue"] = "keyword",
["Default"] = "keyword",
["Dim"] = "keyword",
["DimStr"] = "keyword",
["Do"] = "keyword",
["Else"] = "keyword",
["EndBlock"] = "keyword",
["EndFunction"] = "keyword",
["EndIf"] = "keyword",
["EndSwitch"] = "keyword",
["FallThrough"] = "keyword",
["For"] = "keyword",
["Forever"] = "keyword",
["Function"] = "keyword",
["Global"] = "keyword",
["Gosub"] = "keyword",
["Goto"] = "keyword",
["If"] = "keyword",
["In"] = "keyword",
["Label"] = "keyword",
["Local"] = "keyword",
["Next"] = "keyword",
["Repeat"] = "keyword",
["Return"] = "keyword",
["Step"] = "keyword",
["Switch"] = "keyword",
["Then"] = "keyword",
["To"] = "keyword",
["Until"] = "keyword",
["Wend"] = "keyword",
["While"] = "keyword",
["False"] = "literal",
["Nil"] = "literal",
["True"] = "literal",
["%"] = "operator",
["&"] = "operator",
["*"] = "operator",
["+"] = "operator",
["-"] = "operator",
["."] = "operator",
["// /"] = "operator",
[":"] = "operator",
["<"] = "operator",
["="] = "operator",
[">"] = "operator",
["<>"] = "operator",
["<="] = "operator",
["=>"] = "operator",
["^"] = "operator",
["|"] = "operator",
["~"] = "operator",
["\\"] = "operator",
["And"] = "operator",
["Not"] = "operator",
["Or"] = "operator"
}
}