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

syntax.add({
	name = "Tab-Separated Values (TSV)",
	shortname = "TSV",
	author = "liqube",
	extensions = "tsv",
	disable_tab_autocomplete = true,

	patterns = {
		-- first four TSV columns get dedicated styles
		{ pattern = "[^\t\n]+", type = "literal", line_start = true },
		{ pattern = "[^\t\n]+", type = "function", line_prefix = "[^\t\n]*\t" },
		{ pattern = "[^\t\n]+", type = "operator", line_prefix = "[^\t\n]*\t[^\t\n]*\t" },
--		{ pattern = "[^\t\n]+",                 type = "literal",  line_prefix = "[^\t\n]*\t[^\t\n]*\t[^\t\n]*\t" },

		{ pattern = "[\t]", type = "operator" }, -- separators
		{ pattern = { '"', '"', "\\" }, type = "string" }, -- quoted text (col 5+ fallback)
		{ pattern = { "'", "'", "\\" }, type = "string" }, -- quoted text (col 5+ fallback)
		{ pattern = "-?%.?%d+f?", type = "number" }, -- numbers (col 5+ fallback)
		{ pattern = "[^\t\n]+", type = "normal" }, -- everything else
	},
})
