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

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

SyntaxDefinition& addRave() {

	auto& sd = SyntaxDefinitionManager::instance()->add(
		{ "Rave",
		  { "%.rave$" },
		  {
			  { { "//.-\n" }, "comment" },
			  { { "/%*", "%*/" }, "comment" },
			  { { "\"", "\"", "\\" }, "string" },
			  { { "'", "'", "\\" }, "string" },
			  { { "0[oO_][0-7]+" }, "number" },
			  { { "-?0x[%x_]+" }, "number" },
			  { { "-?%d+_%d" }, "number" },
			  { { "-?%d+[%d%.eE]*f?" }, "number" },
			  { { "-?%.?%d+f?" }, "number" },
			  { { "(namespace)%s+([%a_][%w_]*)" }, { "keyword", "keyword", "type" } },
			  { { "%(%s*inline%s*%)" }, "keyword" },
			  { { "%(%s*inline%,%s*nochecks%s*%)" }, "keyword" },
			  { { "%(%s*nochecks%s*%)" }, "keyword" },
			  { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" },
			  { { "[%a_][%w_]*%f[(]" }, "function" },
			  { { "std%:%:[%w_]*" }, "type" },
			  { { "@[%a_][%w_]*" }, "symbol" },
			  { { "[%a_][%w_]*" }, "symbol" },
		  },
		  {
			  { "extern", "keyword" },
			  { "import", "keyword" },
			  { "break", "keyword" },
			  { "continue", "keyword" },
			  { "if", "keyword" },
			  { "else", "keyword" },
			  { "in", "keyword" },
			  { "likely", "keyword" },
			  { "unlikely", "keyword" },
			  { "foreach", "keyword" },
			  { "switch", "keyword" },
			  { "case", "keyword" },
			  { "default", "keyword" },
			  { "cast", "keyword" },
			  { "null", "literal" },
			  { "while", "keyword" },
			  { "for", "keyword" },
			  { "return", "keyword" },
			  { "defer", "keyword" },
			  { "fdefer", "keyword" },
			  { "const", "type" },
			  { "alias", "type" },
			  { "void", "type" },
			  { "bool", "type" },
			  { "char", "type" },
			  { "uchar", "type" },
			  { "short", "type" },
			  { "ushort", "type" },
			  { "int", "type" },
			  { "uint", "type" },
			  { "long", "type" },
			  { "ulong", "type" },
			  { "cent", "type" },
			  { "ucent", "type" },
			  { "float", "type" },
			  { "double", "type" },
			  { "auto", "type" },
			  { "half", "type" },
			  { "bhalf", "type" },
			  { "real", "type" },
			  { "short8", "type" },
			  { "int4", "type" },
			  { "int8", "type" },
			  { "float2", "type" },
			  { "float4", "type" },
			  { "float8", "type" },
			  { "double2", "type" },
			  { "double4", "type" },
			  { "true", "literal" },
			  { "false", "literal" },
			  { "struct", "keyword" },
			  { "namespace", "keyword" },
			  { "@if", "keyword" },
			  { "@else", "keyword" },
			  { "@return", "function" },
			  { "@echo", "function" },
			  { "@warning", "function" },
			  { "@error", "function" },
			  { "@compileAndLink", "function" },
			  { "@contains", "function" },
			  { "@aliasExists", "function" },
			  { "@baseType", "function" },
			  { "@isNumeric", "function" },
			  { "@isStructure", "function" },
			  { "@isPointer", "function" },
			  { "@isArray", "function" },
			  { "@isVector", "function" },
			  { "@atomicTAS", "function" },
			  { "@atomicClear", "function" },
			  { "@getArg", "function" },
			  { "@getCurrArg", "function" },
			  { "@getArgType", "function" },
			  { "@getCurrArgType", "function" },
			  { "@skipArg", "function" },
			  { "@callWithArgs", "function" },
			  { "@callWithBeforeArgs", "function" },
			  { "@argsLength", "function" },
			  { "@foreachArgs", "function" },
			  { "@hasMethod", "function" },
			  { "@vFrom", "function" },
			  { "@vLoad", "function" },
			  { "@vStore", "function" },
			  { "@vShuffle", "function" },

		  },
		  "//" } );

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

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