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

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

SyntaxDefinition& addU() {

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

		{ "Ü",
		  { "%.u$", "%.uh$" },
		  {
			  { { "//.-\n" }, "comment" },			  // Single-line comments.
			  { { "/%*", "%*/" }, "comment" },		  // Multi-line comments.
			  { { "\"", "[\"\n]", "\\" }, "string" }, // String literals.
			  { { "'", "'", "\\" }, "string" },		  // Char literals.
			  { { "cpp_number_parser" },
				"number",
				"",
				SyntaxPatternMatchType::Parser }, // Numbers. TODO - support Ü-specific formats.
			  { { "[%+%-=/%*%^%%<>!~|&$:.@?]" }, "operator" }, // Various operators.
			  { { "[%a_][%w_]*" }, "symbol" },				   // Regular identifiers.
		  },
		  { // Keywords.
			{ "fn", "keyword" },
			{ "op", "keyword" },
			{ "var", "keyword" },
			{ "auto", "keyword" },
			{ "return", "keyword" },
			{ "yield", "keyword" },
			{ "label", "keyword" },
			{ "while", "keyword" },
			{ "loop", "keyword" },
			{ "break", "keyword" },
			{ "continue", "keyword" },
			{ "if", "keyword" },
			{ "static_if", "keyword" },
			{ "enable_if", "keyword" },
			{ "if_coro_advance", "keyword" },
			{ "else", "keyword" },
			{ "move", "keyword" },
			{ "take", "keyword" },
			{ "byval", "keyword" },
			{ "tup", "keyword" },
			{ "struct", "keyword" },
			{ "class", "keyword" },
			{ "final", "keyword" },
			{ "polymorph", "keyword" },
			{ "interface", "keyword" },
			{ "abstract", "keyword" },
			{ "non_sync", "keyword" },
			{ "ordered", "keyword" },
			{ "nodiscard", "keyword" },
			{ "nomangle", "keyword" },
			{ "call_conv", "keyword" },
			{ "virtual", "keyword" },
			{ "override", "keyword" },
			{ "pure", "keyword" },
			{ "generator", "keyword" },
			{ "async", "keyword" },
			{ "await", "keyword" },
			{ "namespace", "keyword" },
			{ "public", "keyword" },
			{ "private", "keyword" },
			{ "protected", "keyword" },
			{ "true", "literal" },
			{ "false", "literal" },
			{ "mut", "keyword" },
			{ "imut", "keyword" },
			{ "constexpr", "keyword" },
			{ "const", "keyword" },
			{ "zero_init", "keyword" },
			{ "this", "keyword" },
			{ "base", "keyword" },
			{ "constructor", "keyword" },
			{ "destructor", "keyword" },
			{ "conversion_constructor", "keyword" },
			{ "static_assert", "keyword" },
			{ "halt", "keyword" },
			{ "safe", "keyword" },
			{ "type", "keyword" },
			{ "typeinfo", "keyword" },
			{ "same_type", "keyword" },
			{ "typeof", "keyword" },
			{ "template", "keyword" },
			{ "enum", "keyword" },
			{ "cast_ref", "keyword" },
			{ "cast_imut", "keyword" },
			{ "alloca", "keyword" },
			{ "as", "keyword" },
			{ "is", "keyword" },
			{ "import", "keyword" },
			{ "export", "keyword" },
			{ "embed", "keyword" },
			{ "default", "keyword" },
			{ "delete", "keyword" },
			{ "for", "keyword" },
			{ "with", "keyword" },
			{ "do", "keyword" },
			{ "switch", "keyword" },
			{ "case", "keyword" },
			{ "typename", "keyword" },
			{ "lambda", "keyword" },
			{ "static", "keyword" },
			{ "package", "keyword" },
			{ "module", "keyword" },
			{ "mixin", "keyword" },
			{ "thread_local", "keyword" },
			{ "unsafe", "keyword" },
			{ "cast_ref_unsafe", "keyword" },
			{ "cast_mut", "keyword" },
			{ "uninitialized", "keyword" },
			// Built-in type keywords.
			{ "void", "type" },
			{ "bool", "type" },
			{ "i8", "type" },
			{ "u8", "type" },
			{ "i16", "type" },
			{ "u16", "type" },
			{ "i32", "type" },
			{ "u32", "type" },
			{ "i64", "type" },
			{ "u64", "type" },
			{ "i128", "type" },
			{ "u128", "type" },
			{ "i256", "type" },
			{ "u256", "type" },
			{ "i512", "type" },
			{ "u512", "type" },
			{ "i1024", "type" },
			{ "u1024", "type" },
			{ "i2048", "type" },
			{ "u2048", "type" },
			{ "i4096", "type" },
			{ "u4096", "type" },
			{ "f16", "type" },
			{ "f32", "type" },
			{ "f80", "type" },
			{ "f64", "type" },
			{ "f128", "type" },
			{ "char8", "type" },
			{ "char16", "type" },
			{ "char32", "type" },
			{ "byte8", "type" },
			{ "byte16", "type" },
			{ "byte32", "type" },
			{ "byte64", "type" },
			{ "byte128", "type" },
			{ "byte256", "type" },
			{ "byte512", "type" },
			{ "byte1024", "type" },
			{ "byte2048", "type" },
			{ "byte4096", "type" },
			{ "size_type", "type" },
			{ "ssize_type", "type" } },
		  "//",
		  {},
		  "ü" } );

	sd.setFoldRangeType( FoldRangeType::Braces ).setFoldBraces( { { '{', '}' } } );
	sd.setBlockComment( { "/*", "*/" } );
	return sd;
}

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