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

format.register({
	name = "LRC Lyrics",
	shortname = "LRC",
	extensions = "lrc",
	author = "liqube",
	created = "2026-02-15",
	--  comment = "//",

	patterns = {
		{ pattern = "//.-\n", type = "comment" }, -- // line comment
		{ pattern = { "/%*", "%*/" }, type = "comment" }, -- /* block comment */
		-- Keys by container value kind: "key": { ... } / "key": [ ... ]
		{
			pattern = { '"', '"', "\\" },
			type = "object",
			delim_type = "operator",
			followed_by = "%s*:%s*{",
			not_followed_by = "%s*.-%}",
		}, -- object-valued key (non-inline)
		{
			pattern = { '"', '"', "\\" },
			type = "array",
			delim_type = "operator",
			followed_by = "%s*:%s*%[",
			not_followed_by = "%s*.-%]",
		}, -- array-valued key (non-inline)
		-- Other keys: "key": <scalar>
		{ pattern = { '"', '"', "\\" }, type = "key", delim_type = "operator", followed_by = "%s*:" }, -- scalar-valued key
		-- Regular string values: "value"
		{ pattern = { '"', '"', "\\" }, type = "string", delim_type = "operator" }, -- string literal value
		{ pattern = "0x[%da-fA-F]+", type = "number" }, -- hex number
		{ pattern = "-?%d+[%d%.eE]*", type = "number" }, -- integer/float/exponent
		{ pattern = "-?%.?%d+", type = "number" }, -- fallback numeric form
		{ pattern = "[{}:%[%],]", type = "operator" }, -- JSON punctuation
		{ pattern = "[%a_][%w_]*", type = "symbol" }, -- bare identifiers (true/false/null via symbols map)
	},

	-- Outline points for object-valued keys: "key": {
	--  outline_patterns = {
	--    { pattern = '".-"%s*:%s*[%{%[]', not_followed_by = "%s*.-[%}%]]" },
	--  },
})
