#include <eepp/ui/doc/languages/zig.hpp>
#include <eepp/ui/doc/syntaxdefinitionmanager.hpp>

namespace EE { namespace UI { namespace Doc { namespace Language {

SyntaxDefinition& addZig() {

	auto& sd = SyntaxDefinitionManager::instance()->add(

		{ "Zig",
		  { "%.zig$" },
		  {
			  { { "//.-\n" }, "comment" },
			  { { "\\\\.-\n" }, "string" },
			  { { "\"", "\"", "\\" }, "string" },
			  { { "'", "'", "\\" }, "string" },
			  { { "[iu][%d_]+" }, "type" },
			  { { "0b[01_]+" }, "number" },
			  { { "0o[0-7_]+" }, "number" },
			  { { "0x[%x_]+" }, "number" },
			  { { "0x[%x_]+%.[%x_]*[pP][-+]?%d+" }, "number" },
			  { { "0x[%x_]+%.[%x_]*" }, "number" },
			  { { "0x%.[%x_]+[pP][-+]?%d+" }, "number" },
			  { { "0x%.[%x_]+" }, "number" },
			  { { "0x[%x_]+[pP][-+]?%d+" }, "number" },
			  { { "0x[%x_]+" }, "number" },
			  { { "%d[%d_]*%.[%d_]*[eE][-+]?%d+" }, "number" },
			  { { "%d[%d_]*%.[%d_]*" }, "number" },
			  { { "%d[%d_]*" }, "number" },
			  { { "[%+%-=/%*%^%%<>!~|&%.%?]" }, "operator" },
			  { { "([%a_][%w_]*)(%s*%()" }, { "function", "function", "normal" } },
			  { { "[A-Z][%w_]*" }, "type" },
			  { { "[%a_][%w_]*" }, "symbol" },
			  { { "(@)([%a_][%w_]*)" }, { "operator", "operator", "function" } },

		  },
		  {
			  { "f64", "type" },
			  { "enum", "keyword" },
			  { "noalias", "keyword" },
			  { "c_void", "type" },
			  { "allowzero", "keyword" },
			  { "opaque", "keyword" },
			  { "c_uint", "type" },
			  { "and", "keyword" },
			  { "f16", "type" },
			  { "c_ulong", "type" },
			  { "nakedcc", "keyword" },
			  { "error", "keyword" },
			  { "callconv", "keyword" },
			  { "test", "keyword" },
			  { "f32", "type" },
			  { "f80", "type" },
			  { "const", "keyword" },
			  { "union", "keyword" },
			  { "nosuspend", "keyword" },
			  { "align", "keyword" },
			  { "anytype", "keyword" },
			  { "async", "keyword" },
			  { "return", "keyword" },
			  { "errdefer", "keyword" },
			  { "cancel", "keyword" },
			  { "undefined", "literal" },
			  { "true", "literal" },
			  { "usingnamespace", "keyword" },
			  { "void", "type" },
			  { "volatile", "keyword" },
			  { "linksection", "keyword" },
			  { "threadlocal", "keyword" },
			  { "suspend", "keyword" },
			  { "struct", "keyword" },
			  { "comptime", "keyword" },
			  { "null", "literal" },
			  { "try", "keyword" },
			  { "bool", "type" },
			  { "comptime_int", "type" },
			  { "continue", "keyword" },
			  { "anyerror", "type" },
			  { "type", "type" },
			  { "c_longdouble", "type" },
			  { "resume", "keyword" },
			  { "noreturn", "type" },
			  { "c_ulonglong", "type" },
			  { "c_long", "type" },
			  { "c_int", "type" },
			  { "c_longlong", "type" },
			  { "c_ushort", "type" },
			  { "c_short", "type" },
			  { "noasync", "keyword" },
			  { "defer", "keyword" },
			  { "f128", "type" },
			  { "else", "keyword" },
			  { "isize", "type" },
			  { "break", "keyword" },
			  { "export", "keyword" },
			  { "packed", "keyword" },
			  { "extern", "keyword" },
			  { "fn", "keyword" },
			  { "if", "keyword" },
			  { "anyframe", "keyword" },
			  { "switch", "keyword" },
			  { "orelse", "keyword" },
			  { "usize", "type" },
			  { "unreachable", "keyword" },
			  { "asm", "keyword" },
			  { "for", "keyword" },
			  { "while", "keyword" },
			  { "inline", "keyword" },
			  { "comptime_float", "type" },
			  { "var", "keyword" },
			  { "catch", "keyword" },
			  { "or", "keyword" },
			  { "false", "literal" },
			  { "pub", "keyword" },
			  { "await", "keyword" },
			  { "ccc", "keyword" },
			  { "stdcallcc", "keyword" },

		  },
		  "//",
		  {}

		} );

	sd.setFoldRangeType( FoldRangeType::Braces ).setFoldBraces( { { '{', '}' } } );
	return sd;
}

}}}} // namespace EE::UI::Doc::Language
