Implementation
final nim = Mode(
refs: {},
name: "Nim",
keywords: {
"keyword": [
"addr",
"and",
"as",
"asm",
"bind",
"block",
"break",
"case",
"cast",
"const",
"continue",
"converter",
"discard",
"distinct",
"div",
"do",
"elif",
"else",
"end",
"enum",
"except",
"export",
"finally",
"for",
"from",
"func",
"generic",
"guarded",
"if",
"import",
"in",
"include",
"interface",
"is",
"isnot",
"iterator",
"let",
"macro",
"method",
"mixin",
"mod",
"nil",
"not",
"notin",
"object",
"of",
"or",
"out",
"proc",
"ptr",
"raise",
"ref",
"return",
"shared",
"shl",
"shr",
"static",
"template",
"try",
"tuple",
"type",
"using",
"var",
"when",
"while",
"with",
"without",
"xor",
"yield"
],
"literal": ["true", "false"],
"type": [
"int",
"int8",
"int16",
"int32",
"int64",
"uint",
"uint8",
"uint16",
"uint32",
"uint64",
"float",
"float32",
"float64",
"bool",
"char",
"string",
"cstring",
"pointer",
"expr",
"stmt",
"void",
"auto",
"any",
"range",
"array",
"openarray",
"varargs",
"seq",
"set",
"clong",
"culong",
"cchar",
"cschar",
"cshort",
"cint",
"csize",
"clonglong",
"cfloat",
"cdouble",
"clongdouble",
"cuchar",
"cushort",
"cuint",
"culonglong",
"cstringarray",
"semistatic"
],
"built_in": ["stdin", "stdout", "stderr", "result"]
},
contains: [
Mode(className: "meta", begin: "\\{\\.", end: "\\.\\}", relevance: 10),
Mode(
className: "string",
begin: "[a-zA-Z]\\w*\"",
end: "\"",
contains: [Mode(begin: "\"\"")]),
Mode(className: "string", begin: "([a-zA-Z]\\w*)?\"\"\"", end: "\"\"\""),
QUOTE_STRING_MODE,
Mode(className: "type", begin: "\\b[A-Z]\\w+\\b", relevance: 0),
Mode(className: "number", relevance: 0, variants: [
Mode(
begin: "\\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?"),
Mode(begin: "\\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?"),
Mode(begin: "\\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?"),
Mode(begin: "\\b(\\d[_\\d]*)('?[iIuUfF](8|16|32|64))?")
]),
HASH_COMMENT_MODE
]);