-- mod-version:3
local syntax = require "core.syntax"

syntax.add {
	name = "C3",
	files = { "%.c3$", "%.c3i$", "%.c3t$" },
	comment = "//",
	block_comment = {"/*", "*/"},
	
	patterns = {
		{ pattern = "//.-\n",                   type = "comment"  },
		{ pattern = { "/%*", "%*/" },           type = "comment"  },
		{ pattern = { "<%*", "%*>" },           type = "comment"  },
		{ pattern = { '"', '"', '\\' },         type = "string"   },
		{ pattern = { "`", "`", '\\' },         type = "string"   },
		{ pattern = { "'", "'", '\\' },         type = "string"   },
		{ pattern = "0b[01_]+",                 type = "number"   },
		{ pattern = "0[oO][0-7_]+",             type = "number"   },
		{ pattern = "0[xX][%da-fA-F_]+",        type = "number"   },
		{ pattern = "%d+[%d%._e]*",             type = "number"   },
		{ pattern = "[%l_]+[%u]*[%w_]*%f[(]",   type = "function" },
		{ pattern = "[%l_]+[%u%d]*",            type = "symbol"   },
		{ pattern = "[%u_]+[%l%d]*",            type = "keyword2" },
	},
	
	symbols = {
	["alias"]       = "keyword",
	["asm"]         = "keyword",
	["assert"]      = "keyword",
	["attrdef"]     = "keyword",
	["bitstruct"]   = "keyword",
	["break"]       = "keyword",
	["case"]        = "keyword",
	["catch"]       = "keyword",
	["const"]       = "keyword",
	["continue"]    = "keyword",
	["default"]     = "keyword",
	["defer"]       = "keyword",
	["do"]          = "keyword",
	["else"]        = "keyword",
	["enum"]        = "keyword",
	["extern"]      = "keyword",
	["faultdef"]    = "keyword",
	["fn"]          = "keyword",
	["for"]         = "keyword",
	["foreach"]     = "keyword",
	["foreach_r"]   = "keyword",
	["if"]          = "keyword",
	["import"]      = "keyword",
	["inline"]      = "keyword",
	["interface"]   = "keyword",
	["macro"]       = "keyword",
	["module"]      = "keyword",
	["nextcase"]    = "keyword",
	["return"]      = "keyword",
	["static"]      = "keyword",
	["struct"]      = "keyword",
	["switch"]      = "keyword",
	["tlocal"]      = "keyword",
	["try"]         = "keyword",
	["typedef"]     = "keyword",
	["typeid"]      = "keyword",
	["union"]       = "keyword",
	["var"]         = "keyword",
	["while"]       = "keyword",
	["$alignof"]    = "keyword",
	["$assert"]     = "keyword",
	["$assignable"] = "keyword",
	["$case"]       = "keyword",
	["$default"]    = "keyword",
	["$defined"]    = "keyword",
	["$echo"]       = "keyword",
	["$else"]       = "keyword",
	["$embed"]      = "keyword",
	["$endfor"]     = "keyword",
	["$endforeach"] = "keyword",
	["$endif"]      = "keyword",
	["$endswitch"]  = "keyword",
	["$eval"]       = "keyword",
	["$evaltype"]   = "keyword",
	["$error"]      = "keyword",
	["$exec"]       = "keyword",
	["$extnameof"]  = "keyword",
	["$feature"]    = "keyword",
	["$for"]        = "keyword",
	["$foreach"]    = "keyword",
	["$if"]         = "keyword",
	["$include"]    = "keyword",
	["$is_const"]   = "keyword",
	["$nameof"]     = "keyword",
	["$offsetof"]   = "keyword",
	["$qnameof"]    = "keyword",
	["$sizeof"]     = "keyword",
	["$stringify"]  = "keyword",
	["$switch"]     = "keyword",
	["$typefrom"]   = "keyword",
	["$typeof"]     = "keyword",
	["$vaarg"]      = "keyword",
	["$vacount"]    = "keyword",
	["$vaconst"]    = "keyword",
	["$vaexpr"]     = "keyword",
	["$vasplat"]    = "keyword",
	["$vatype"]     = "keyword",
	
	--types
	["any"]      = "keyword2",
	["bfloat"]   = "keyword2",
	["bool"]     = "keyword2",
	["char"]     = "keyword2",
	["double"]   = "keyword2",
	["fault"]    = "keyword2",
	["float"]    = "keyword2",
	["float128"] = "keyword2",
	["float16"]  = "keyword2",
	["ichar"]    = "keyword2",
	["int"]      = "keyword2",
	["int128"]   = "keyword2",
	["iptr"]     = "keyword2",
	["isz"]      = "keyword2",
	["long"]     = "keyword2",
	["short"]    = "keyword2",
	["uint"]     = "keyword2",
	["uint128"]  = "keyword2",
	["ulong"]    = "keyword2",
	["uptr"]     = "keyword2",
	["ushort"]   = "keyword2",
	["usz"]      = "keyword2",
	["void"]     = "keyword2",
	
	--literals
	["true"]  = "literal",
	["false"] = "literal",
	["null"]  = "literal",

	--operators
	["&"]   = "operator",
	["!"]   = "operator",
	["~"]   = "operator",
	["|"]   = "operator",
	["^"]   = "operator",
	[":"]   = "operator",
	[","]   = "operator",
	[";"]   = "operator",
	["="]   = "operator",
	[">"]   = "operator",
	["/"]   = "operator",
	["."]   = "operator",
	["<"]   = "operator",
	["{"]   = "operator",
	["["]   = "operator",
	["("]   = "operator",
	["-"]   = "operator",
	["%"]   = "operator",
	["+"]   = "operator",
	["?"]   = "operator",
	["}"]   = "operator",
	["]"]   = "operator",
	[")"]   = "operator",
	["*"]   = "operator",
	["&&"]  = "operator",
	["->"]  = "operator",
	["!!"]  = "operator",
	["&="]  = "operator",
	["|="]  = "operator",
	["^="]  = "operator",
	["/="]  = "operator",
	[".."]  = "operator",
	["?:"]  = "operator",
	["=="]  = "operator",
	[">="]  = "operator",
	["=>"]  = "operator",
	["<="]  = "operator",
	["[<"]  = "operator",
	["-="]  = "operator",
	["--"]  = "operator",
	["%="]  = "operator",
	["*="]  = "operator",
	["!="]  = "operator",
	["||"]  = "operator",
	["+="]  = "operator",
	["++"]  = "operator",
	[">]"]  = "operator",
	["??"]  = "operator",
	["::"]  = "operator",
	["<<"]  = "operator",
	[">>"]  = "operator",
	["..."] = "operator",
	["<<="] = "operator",
	[">>="] = "operator",
	["&&&"] = "operator",
	["+++"] = "operator",
	["|||"] = "operator",

	--attributes
	["@align"]            = "function",
	["@allow_deprecated"] = "function",
	["@benchmark"]        = "function",
	["@bigendian"]        = "function",
	["@builtin"]          = "function",
	["@callconv"]         = "function",
	["@compact"]          = "function",
	["@const"]            = "function",
	["@deprecated"]       = "function",
	["@dynamic"]          = "function",
	["@export"]           = "function",
	["@extern"]           = "function",
	["@finalizer"]        = "function",
	["@format"]           = "function",
	["@if"]               = "function",
	["@inline"]           = "function",
	["@init"]             = "function",
	["@jump"]             = "function",
	["@link"]             = "function",
	["@littleendian"]     = "function",
	["@local"]            = "function",
	["@maydiscard"]       = "function",
	["@naked"]            = "function",
	["@noalias"]          = "function",
	["@nodiscard"]        = "function",
	["@noinit"]           = "function",
	["@noinline"]         = "function",
	["@nopadding"]        = "function",
	["@norecurse"]        = "function",
	["@noreturn"]         = "function",
	["@nosanitize"]       = "function",
	["@nostrip"]          = "function",
	["@obfuscate"]        = "function",
	["@operator"]         = "function",
	["@operator_r"]       = "function",
	["@operator_s"]       = "function",
	["@optional"]         = "function",
	["@overlap"]          = "function",
	["@packed"]           = "function",
	["@private"]          = "function",
	["@public"]           = "function",
	["@pure"]             = "function",
	["@reflect"]          = "function",
	["@safemacro"]        = "function",
	["@section"]          = "function",
	["@structlike"]       = "function",
	["@tag"]              = "function",
	["@test"]             = "function",
	["@unused"]           = "function",
	["@used"]             = "function",
	["@wasm"]             = "function",
	["@weak"]             = "function",
	["@winmain"]          = "function"
	},
}
