-- lx-bundle:true

--- Syntax style description lookup for style.syntax keys
-- @module core.format.styledesc
local styledesc = {}

local entries = {
	{ name = "normal", description = "Default text token" },
	{ name = "symbol", description = "Identifiers and generic symbols" },
	{ name = "comment", description = "Primary comment text" },
	{ name = "comment2", description = "Secondary comment text" },
	{ name = "keyword", description = "Primary language keywords" },
	{ name = "keyword2", description = "Secondary language keywords" },
	{ name = "number", description = "Numeric values" },
	{ name = "hex", description = "Hexadecimal numeric values" },
	{ name = "literal", description = "Literal constants" },
	{ name = "string", description = "String values" },
	{ name = "operator", description = "Operators and punctuation" },
	{ name = "function", description = "Function names" },
	{ name = "variable", description = "Variable names" },
	{ name = "constant", description = "Constant names" },
	{ name = "control", description = "Control flow tokens" },
	{ name = "exception", description = "Exception handling tokens" },
	{ name = "date", description = "Date-like values" },
	{ name = "time", description = "Time-like values" },
	{ name = "key", description = "Key part in key-value text" },
	{ name = "value", description = "Value part in key-value text" },
	{ name = "object", description = "Object key-like tokens" },
	{ name = "array", description = "Array related tokens" },
	{ name = "meta", description = "Metadata or directive tokens" },
	{ name = "label", description = "Label tokens" },
	{ name = "italic", description = "Italic document tokens" },
	{ name = "bold", description = "Bold document tokens" },
	{ name = "bold_italic", description = "Bold italic document tokens" },
	{ name = "heading", description = "Generic heading text" },
	{ name = "heading1", description = "Heading level 1" },
	{ name = "heading2", description = "Heading level 2" },
	{ name = "heading3", description = "Heading level 3" },
	{ name = "heading4", description = "Heading level 4" },
	{ name = "heading5", description = "Heading level 5" },
	{ name = "heading6", description = "Heading level 6" },
	{ name = "quote", description = "Quoted document text" },
	{ name = "error", description = "Error tokens" },
	{ name = "success", description = "Success state tokens" },
	{ name = "warning", description = "Warning state tokens" },
	{ name = "notice", description = "Notice state tokens" },
	{ name = "remark", description = "Remark or helper tokens" },
	{ name = "changed", description = "Changed diff-like tokens" },
	{ name = "added", description = "Added diff-like tokens" },
	{ name = "removed", description = "Removed diff-like tokens" },
	{ name = "separator", description = "Separator or divider tokens" },
	{ name = "preprocessor", description = "Preprocessor or directive tokens" },
}

local by_name = {}
for i = 1, #entries do
	local item = entries[i]
	by_name[item.name] = item.description
end

--- Return ordered style description entries
-- @return table entries ordered list with name and description keys
function styledesc.get_entries()
	return entries
end

--- Return description text for one syntax style key
-- @param name string syntax style key
-- @return string|nil description plain english description or nil
function styledesc.get_description(name)
	return by_name[name]
end

return styledesc
