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

format.register({
	name = "Resonic Playlist Layout",
	shortname = "resopll",
	author = "liqube",
	extensions = "txt",

	-- Only match this syntax when header also matches
	require_header_match = true,
	headers = "^;Resonic Playlist Layout",
	comment = "[;#]",

	patterns = {
		{ pattern = ";Resonic Playlist Layout", type = "meta", line_start = true },
		{ pattern = "[;#].-\n", type = "comment" },
		{ pattern = "(@version)%s+(.-)\n", type = { "function", "string" }, line_start = true },
		{ pattern = "(@author)%s+(.-)\n", type = { "function", "string" }, line_start = true },
		{ pattern = "(@title)%s+(.-)\n", type = { "function", "string" }, line_start = true },
		{ pattern = "(@created)%s+(.-)\n", type = { "function", "string" }, line_start = true },
		{ pattern = "(@sort)%s+(.-)\n", type = { "function", "string" }, line_start = true },
		{ pattern = "[%a_][%w_]*", type = "symbol" },
		{ pattern = "-?%d+[%d%.eE]*[c%%]", type = "hex" },
		{ pattern = "-?%.?%d+[%%]?", type = "number" },
	},

	symbols = {
		["main"] = "keyword",
		["fit"] = "keyword",
		["right"] = "keyword",
		["left"] = "keyword",
		["min"] = "keyword",
		["max"] = "keyword",
		["low"] = "keyword",
	},
})
