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

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

SyntaxDefinition& addRacket() {

	return SyntaxDefinitionManager::instance()
		->add(

			{ "Racket",
			  { "%.rkt$" },
			  {
				  { { "include", "#top-level-clause" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },

			  },
			  {

			  },
			  "",
			  {}

			} )
		.addRepositories( {

			{ "syntax-unquote",
			  {
				  { { "(#,@?(?=[\\(\\[]))|((?=[\\(\\[]unquote[\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])"
					  ")|((?=[\\(\\[]unquote-splicing[\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]))",
					  "(?<=[\\)\\]])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(#,@?)(?=[^\\s\\{\\}\\(\\)\\[\\]\\|,\"'´\\\\;])",
					  "(?![^\\s\\{\\}\\(\\)\\[\\]\\|,\"'´\\\\;])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "parameter-with-default-value",
			  {
				  { { "\\[", "\\]" },
					{ "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=\\[)\\s*([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)" },
						  { "normal", "parameter" },
						  {},
						  "",
						  SyntaxPatternMatchType::RegEx },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "string",
			  {
				  { { "#(r|p)x\"", "\"" },
					{ "string" },
					{ "string" },
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "#\"", "\"" },
					{ "string" },
					{ "string" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#escaped-char" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "\"", "\"" },
					{ "string" },
					{ "string" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#escaped-char" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "parentheses",
			  {
				  { { "\\(", "\\)" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#parentheses" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "top-level-clause",
			  {
				  { { "include", "#dot-operators" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#atom" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#sexp" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#vector" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#hash" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#comment" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#quotes" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },

			  } },
			{ "quoted-sexp",
			  {
				  { { "(\\()|(\\[)|(\\{)", "(\\))|(\\])|(\\})" },
					{ "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#dot-operators" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quoted-atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "quoted-atom",
			  {
				  { { "[^\\.\\s][^\\s\\{\\}\\(\\)\\[\\]\\|,'´;]*" },
					"literal",
					"",
					SyntaxPatternMatchType::RegEx },

			  } },
			{ "quotes",
			  {
				  { { "include", "#quote" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#quasiquote" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#syntax-quote" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#syntax-quasiquote" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },

			  } },
			{ "value-assignment-expression",
			  {
				  { { "(\\[)\\s*([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"]+)", "\\]" },
					{ "normal", "operator", "normal" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "quasiquoted-sexp",
			  {
				  { { "(?<![,@])(\\()", "(\\))" },
					{ "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#dot-operators" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#unquote-syntax" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#unquote" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quasiquoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quoted-atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { ",@?" }, "error", "", SyntaxPatternMatchType::RegEx },

					} },

			  } },
			{ "pattern-match-clause",
			  {
				  { { "(#[&s]?)?\\(", "\\)" },
					{ "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=[\\(\\)\\[\\]\\{\\}\\s])_(?=[\\(\\)\\[\\]\\{\\}\\s])" },
						  "keyword",
						  "",
						  SyntaxPatternMatchType::RegEx },
						{ { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.{3}\\+?(?=[\\(\\)\\[\\]\\{\\}\\s])" },
						  "keyword",
						  "",
						  SyntaxPatternMatchType::RegEx },
						{ { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.(?=[\\(\\)\\[\\]\\{\\}\\s])" },
						  "keyword",
						  "",
						  SyntaxPatternMatchType::RegEx },
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#pattern-match-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "builtin-function",
			  {
				  { { "(\\()\\s*((for\\*?(/"
					  "(lists?|vector|hash(eq(v)?)?|fold|or|and|first|last|sum|product|((mutable|"
					  "weak)\\-)?set(eq(v)?)?))?)|(let\\*?)|do)(?=[\\s\\{\\(\\[#])",
					  "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(\\()\\s*(?=\\[)", "(?<=\\])\\s*(\\))" },
						  { "normal", "operator" },
						  { "normal", "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#value-assignment-expression" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(case)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(\\[)\\s*(?=\\()", "\\]" },
						  { "normal", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "(?<=\\[)\\s*(?=(\\())", "(?<=\\))" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::RegEx,
								{
									{ { "include", "#quoted-sexp" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },
									{ { "include", "#comment" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },

								} },
							  { { "include", "#top-level-clause" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "(\\[)\\s*(else)", "\\]" },
						  { "normal", "operator", "literal" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#top-level-clause" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(syntax-case)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "\\[", "\\]" },
						  { "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "(?<=\\[)\\s*(_)", "(?<=\\])" },
								{ "normal", "keyword" },
								{},
								"",
								SyntaxPatternMatchType::RegEx,
								{
									{ { "include", "#top-level-clause" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },

								} },
							  { { "(?<=\\[)\\s+[^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+",
								  "(?<=\\])" },
								{ "keyword" },
								{},
								"",
								SyntaxPatternMatchType::RegEx,
								{
									{ { "include", "#top-level-clause" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },

								} },
							  { { "(?<=\\[)\\s*(#[&s]?)?\\(", "\\)" },
								{ "operator" },
								{ "operator" },
								"",
								SyntaxPatternMatchType::RegEx,
								{
									{ { "(?<=[\\(\\)\\[\\]\\{\\}\\s])_(?=[\\(\\)\\[\\]\\{\\}\\s]"
										")" },
									  "keyword",
									  "",
									  SyntaxPatternMatchType::RegEx },
									{ { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.{3}(\\+)?(?=[\\(\\)\\[\\]"
										"\\{\\}\\s])" },
									  "keyword",
									  "",
									  SyntaxPatternMatchType::RegEx },
									{ { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.(?=[\\(\\)\\[\\]\\{\\}\\s]"
										")" },
									  "keyword",
									  "",
									  SyntaxPatternMatchType::RegEx },
									{ { "include", "#comment" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },
									{ { "include", "#pattern-match-clause" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },

								} },
							  { { "include", "#top-level-clause" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(match)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "\\[", "\\]" },
						  { "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "(?<=\\[)_", "(?=\\])" },
								{ "keyword" },
								{},
								"",
								SyntaxPatternMatchType::RegEx,
								{
									{ { "include", "#top-level-clause" },
									  { "normal" },
									  {},
									  "",
									  SyntaxPatternMatchType::LuaPattern },

								} },
							  { { "include", "#top-level-clause" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(cond)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(\\[)\\s*(else)", "\\]" },
						  { "normal", "operator", "literal" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#top-level-clause" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "\\[", "\\]" },
						  { "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#top-level-clause" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define-values)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=define-values)\\s*(\\()", "\\)" },
						  { "normal", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "[^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+" },
								"normal",
								"",
								SyntaxPatternMatchType::RegEx },
							  { { "include", "#comment" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define-values-for-syntax)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=define-values-for-syntax)\\s*(\\()", "\\)" },
						  { "normal", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "[^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+" },
								"normal",
								"",
								SyntaxPatternMatchType::RegEx },
							  { { "include", "#comment" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define|define/"
					  "contract|define(-for)?-syntax)\\s+([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)",
					  "\\)" },
					{ "function", "operator", "keyword", "normal" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define)(?=[\\s\\{\\(\\[#])", "(\\))" },
					{ "function", "operator", "keyword" },
					{ "function", "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=define)\\s*(\\()", "\\)" },
						  { "function", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#function-parameters" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(module[+\\*]?)\\s+([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)",
					  "\\)" },
					{ "normal" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define/public)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=define/public\\s*(\\()", "\\)" },
						  { "function", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#function-parameters" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(lambda)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=lambda)\\s*(\\()", "\\)" },
						  { "function", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#function-parameters" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(λ)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=λ)\\s*(\\()", "\\)" },
						  { "function", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#function-parameters" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define-syntax)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=define-syntax)\\s*(\\()", "\\)" },
						  { "function", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#function-parameters" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(define-for-syntax)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=define-for-syntax)\\s*(\\()", "\\)" },
						  { "function", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "include", "#function-parameters" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(struct)(?=\\s)", "\\)" },
					{ "normal", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "(?<=struct)\\s*([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+\\s+)?([^\\s\\{"
							"\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)\\s*(\\()",
							"\\)" },
						  { "normal", "normal", "type", "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "[^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+" },
								"normal",
								"",
								SyntaxPatternMatchType::RegEx },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(class\\*?)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(interface\\*?)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(new)\\s+([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)", "\\)" },
					{ "function", "operator", "function", "normal" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#value-assignment-expression" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(format|f?printf)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "function", "operator", "function" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "\"", "\"" },
						  { "operator" },
						  { "operator" },
						  "",
						  SyntaxPatternMatchType::RegEx,
						  {
							  { { "~[aAnNxXoObBeE%~\\s]" },
								"literal",
								"",
								SyntaxPatternMatchType::RegEx },
							  { { "~.[aAsSvV]" }, "literal", "", SyntaxPatternMatchType::RegEx },
							  { { "include", "#escaped-char" },
								{ "normal" },
								{},
								"",
								SyntaxPatternMatchType::LuaPattern },

						  } },
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*([+\\-*/])(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(or|and|not)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(quote)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "function" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(quasiquote)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "function" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#unquote" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quoted-atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quasiquoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(match)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\()\\s*(set!|set-values!)(?=[\\s\\{\\(\\[#])", "\\)" },
					{ "normal", "operator", "keyword" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "hash",
			  {
				  { { "(#hash(eq(v)?)?)(\\()", "\\)" },
					{ "normal", "operator", "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#quoted-atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "keyword",
			  {
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(#:[^\\s\\{\\}\\(\\)\\[\\]#\\|,"
					  "\"'´\\\\;]+)" },
					"keyword",
					"",
					SyntaxPatternMatchType::RegEx },

			  } },
			{ "comment",
			  {
				  { { "(;).*$" }, "comment", "", SyntaxPatternMatchType::RegEx },
				  { { "(#!( |/)).*$" }, "comment", "", SyntaxPatternMatchType::RegEx },
				  { { "(#;)\\s*(?=\\()", "(?<=\\))" },
					{ "comment", "operator" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#parentheses" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "#;", "(?=\\s|\\]|\\))" },
					{ "operator" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#parentheses" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "#\\|", "\\|#" },
					{ "comment" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#comment" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "quasiquote",
			  {
				  { { "(`)([^\\s\\{\\}\\(\\)\\[\\]\\|,'´;]+)" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(`)(#(hash(eq(v)?)?|\\d*))(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(`)(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quasiquoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "rest-dot",
			  {
				  { { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.(?=[\\(\\)\\[\\]\\{\\}\\s])" },
					"keyword",
					"",
					SyntaxPatternMatchType::RegEx },

			  } },
			{ "atom",
			  {
				  { { "include", "#string" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#quotes" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#constant" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#number" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#character" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#keyword" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },

			  } },
			{ "syntax-quote",
			  {
				  { { "(#')([^\\s\\{\\}\\(\\)\\[\\]\\|,'´;]+)" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(#')(#(hash(eq(v)?)?|\\d*))(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(#')(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "character",
			  {
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(#\\\\([0-7]{3,3}|u[0-9a-fA-F]{1,"
					  "4}|U[0-9a-fA-F]{1,6}))" },
					{ "normal", "string" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(#\\\\(null?|backspace|tab|"
					  "newline|linefeed|return|space|rubout|\\w))(?!\\w)" },
					{ "normal", "string" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },

			  } },
			{ "constant",
			  {
				  { { "#[tTfF]" }, "literal", "", SyntaxPatternMatchType::RegEx },

			  } },
			{ "sexp",
			  {
				  { { "include", "#builtin-function" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "(\\(|\\[)\\s*([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)", "\\)|\\]" },
					{ "function", "operator", "function" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(\\(|\\[)\\s*(\\)|\\])" }, "normal", "", SyntaxPatternMatchType::RegEx },

			  } },
			{ "dot-operators",
			  {
				  { { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.{2}\\d+\\+?(?=[\\(\\)\\[\\]\\{\\}\\s])" },
					"keyword",
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.{3}\\+?(?=[\\(\\)\\[\\]\\{\\}\\s])" },
					"keyword",
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<=[\\(\\)\\[\\]\\{\\}\\s])_(?=[\\(\\)\\[\\]\\{\\}\\s])" },
					"keyword",
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<=[\\(\\)\\[\\]\\{\\}\\s])\\.(?=[\\(\\)\\[\\]\\{\\}\\s])" },
					"keyword",
					"",
					SyntaxPatternMatchType::RegEx },

			  } },
			{ "function-parameters",
			  {
				  { { "include", "#rest-dot" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "(?<=\\()\\s*([^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+)" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "[^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]+" },
					"parameter",
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "include", "#keyword" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#parameter-with-default-value" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },
				  { { "include", "#comment" },
					{ "normal" },
					{},
					"",
					SyntaxPatternMatchType::LuaPattern },

			  } },
			{ "number",
			  {
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(-?\\d+(\\.\\d+)?(e\\d+)?[+-]\\d+"
					  "(\\.\\d+)?(e\\d+)?i)(?![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])" },
					{ "normal", "number" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(-?\\d+(\\.\\d+)?(e\\d+)?@\\d+("
					  "\\.\\d+)?(e\\d+)?)(?![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])" },
					{ "normal", "number" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(-?\\d*\\.\\d+(e\\d+)?)(?![^"
					  "\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])" },
					{ "normal", "number" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(-?\\d+/"
					  "\\d+)(?![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])" },
					{ "normal", "number" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?<![^\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;])(-?\\d+(e\\d+)?)(?![^\\s\\{\\}\\("
					  "\\)\\[\\]#\\|,\"'´\\\\;])" },
					{ "normal", "number" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(?:\\b)((inf\\.0)|(inf\\.f)|(nan\\.0)|(nan\\.f))(?:\\b)" },
					{ "normal", "number" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },

			  } },
			{ "unquote",
			  {
				  { { "(,@?(?=[\\(\\[]))|((?=[\\(\\[]unquote[\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]))"
					  "|((?=[\\(\\[]unquote-splicing[\\s\\{\\}\\(\\)\\[\\]#\\|,\"'´\\\\;]))",
					  "(?<=[\\)\\]])" },
					{ "normal", "function", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(,@?(?=#hash))", "(?<=[\\)\\]])" },
					{ "normal", "function", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#hash" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(,@?(?=#[^:]))", "(?<=[\\)\\]])" },
					{ "normal", "function", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#vector" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(,@?)(?=[^\\s\\{\\}\\(\\)\\[\\]\\|,\"'´\\\\;])",
					  "(?![^\\s\\{\\}\\(\\)\\[\\]\\|,\"'´\\\\;])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#atom" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "quote",
			  {
				  { { "(')([^\\s\\{\\}\\(\\)\\[\\]\\|,'´;#\\\\]+)" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(')(#(hash(eq(v)?)?|\\d*))(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(')(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "vector",
			  {
				  { { "(#(fl|fx)?\\d*)(\\()", "\\)" },
					{ "normal", "operator", "operator" },
					{ "operator" },
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#top-level-clause" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "syntax-quasiquote",
			  {
				  { { "(#`)([^\\s\\{\\}\\(\\)\\[\\]\\|,'´;]+)" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx },
				  { { "(#`)(#(hash(eq(v)?)?|\\d*))(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function", "literal" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },
				  { { "(#`)(?=\\(|\\[)", "(?<=\\)|\\])" },
					{ "normal", "function" },
					{},
					"",
					SyntaxPatternMatchType::RegEx,
					{
						{ { "include", "#quasiquoted-sexp" },
						  { "normal" },
						  {},
						  "",
						  SyntaxPatternMatchType::LuaPattern },

					} },

			  } },
			{ "escaped-char",
			  {
				  { { "\\\\([abfnrtv'\"\\\\]|\\d{1,3}|x\\d{1,2}|u\\d{1,4}|u\\d{4,4}\\\\u\\d{4,4}|"
					  "U\\d{1,8}|\n)" },
					"string",
					"",
					SyntaxPatternMatchType::RegEx },

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

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