-- lx syntax
local syntax = require("core.syntax")

syntax.add({
	name = "Resource Definition Script",
	shortname = "RC",
	author = "liqube",
	extensions = "rc",
	comment = "//",

	patterns = {
		{ pattern = "//.-\n", type = "comment" },
		{ pattern = { "/%*", "%*/" }, type = "comment" },
		{ pattern = { "#", "[^\\]\n" }, type = "preprocessor" },
		{ 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" },
	},

	outline_patterns = {
		{ pattern = "%s*BEGIN%s*$", line_start = true },
	},

	symbols = {
		["ACCELERATORS"] = "keyword",
		["BEGIN"] = "keyword",
		["BITMAP"] = "keyword",
		["BLOCK"] = "keyword",
		["CAPTION"] = "keyword",
		["CLASS"] = "keyword",
		["CURSOR"] = "keyword",
		["DIALOG"] = "keyword",
		["DIALOGEX"] = "keyword",
		["END"] = "keyword",
		["EXSTYLE"] = "keyword",
		["FILEFLAGS"] = "keyword",
		["FILEFLAGSMASK"] = "keyword",
		["FILEOS"] = "keyword",
		["FILESUBTYPE"] = "keyword",
		["FILETYPE"] = "keyword",
		["FILEVERSION"] = "keyword",
		["FONT"] = "keyword",
		["ICON"] = "keyword",
		["LANGUAGE"] = "keyword",
		["MENU"] = "keyword",
		["MENUEX"] = "keyword",
		["POPUP"] = "keyword",
		["PRODUCTVERSION"] = "keyword",
		["RCDATA"] = "keyword",
		["STRINGTABLE"] = "keyword",
		["STYLE"] = "keyword",
		["VALUE"] = "keyword",
		["VERSIONINFO"] = "keyword",
		["VS_VERSION_INFO"] = "keyword",

		["VS_FF_DEBUG"] = "literal",
		["VS_FF_PATCHED"] = "literal",
		["VS_FF_PRERELEASE"] = "literal",
		["VS_FF_PRIVATEBUILD"] = "literal",
		["VS_FF_SPECIALBUILD"] = "literal",
		["VS_FFI_FILEFLAGSMASK"] = "literal",

		["VOS_UNKNOWN"] = "literal",
		["VOS_DOS"] = "literal",
		["VOS_NT"] = "literal",
		["VOS__WINDOWS16"] = "literal",
		["VOS__WINDOWS32"] = "literal",
		["VOS_DOS_WINDOWS16"] = "literal",
		["VOS_DOS_WINDOWS32"] = "literal",
		["VOS_NT_WINDOWS32"] = "literal",

		["VFT_UNKNOWN"] = "literal",
		["VFT_APP"] = "literal",
		["VFT_DLL"] = "literal",
		["VFT_DRV"] = "literal",
		["VFT_FONT"] = "literal",
		["VFT_VXD"] = "literal",
		["VFT_STATIC_LIB"] = "literal",

		["VFT2_UNKNOWN"] = "literal",
		["VFT2_DRV_COMM"] = "literal",
		["VFT2_DRV_PRINTER"] = "literal",
		["VFT2_DRV_KEYBOARD"] = "literal",
		["VFT2_DRV_LANGUAGE"] = "literal",
		["VFT2_DRV_DISPLAY"] = "literal",
		["VFT2_DRV_MOUSE"] = "literal",
		["VFT2_DRV_NETWORK"] = "literal",
		["VFT2_DRV_SYSTEM"] = "literal",
		["VFT2_DRV_INSTALLABLE"] = "literal",
		["VFT2_DRV_SOUND"] = "literal",
		["VFT2_DRV_VERSIONED_PRINTER"] = "literal",

		["VFT2_FONT_RASTER"] = "literal",
		["VFT2_FONT_VECTOR"] = "literal",
		["VFT2_FONT_TRUETYPE"] = "literal",
	},
})
