]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/nim.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / nim.js
1 /*! `nim` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Nim
7 Description: Nim is a statically typed compiled systems programming language.
8 Website: https://nim-lang.org
9 Category: system
10 */
11
12 function nim(hljs) {
13 const TYPES = [
14 "int",
15 "int8",
16 "int16",
17 "int32",
18 "int64",
19 "uint",
20 "uint8",
21 "uint16",
22 "uint32",
23 "uint64",
24 "float",
25 "float32",
26 "float64",
27 "bool",
28 "char",
29 "string",
30 "cstring",
31 "pointer",
32 "expr",
33 "stmt",
34 "void",
35 "auto",
36 "any",
37 "range",
38 "array",
39 "openarray",
40 "varargs",
41 "seq",
42 "set",
43 "clong",
44 "culong",
45 "cchar",
46 "cschar",
47 "cshort",
48 "cint",
49 "csize",
50 "clonglong",
51 "cfloat",
52 "cdouble",
53 "clongdouble",
54 "cuchar",
55 "cushort",
56 "cuint",
57 "culonglong",
58 "cstringarray",
59 "semistatic"
60 ];
61 const KEYWORDS = [
62 "addr",
63 "and",
64 "as",
65 "asm",
66 "bind",
67 "block",
68 "break",
69 "case",
70 "cast",
71 "concept",
72 "const",
73 "continue",
74 "converter",
75 "defer",
76 "discard",
77 "distinct",
78 "div",
79 "do",
80 "elif",
81 "else",
82 "end",
83 "enum",
84 "except",
85 "export",
86 "finally",
87 "for",
88 "from",
89 "func",
90 "generic",
91 "guarded",
92 "if",
93 "import",
94 "in",
95 "include",
96 "interface",
97 "is",
98 "isnot",
99 "iterator",
100 "let",
101 "macro",
102 "method",
103 "mixin",
104 "mod",
105 "nil",
106 "not",
107 "notin",
108 "object",
109 "of",
110 "or",
111 "out",
112 "proc",
113 "ptr",
114 "raise",
115 "ref",
116 "return",
117 "shared",
118 "shl",
119 "shr",
120 "static",
121 "template",
122 "try",
123 "tuple",
124 "type",
125 "using",
126 "var",
127 "when",
128 "while",
129 "with",
130 "without",
131 "xor",
132 "yield"
133 ];
134 const BUILT_INS = [
135 "stdin",
136 "stdout",
137 "stderr",
138 "result"
139 ];
140 const LITERALS = [
141 "true",
142 "false"
143 ];
144 return {
145 name: 'Nim',
146 keywords: {
147 keyword: KEYWORDS,
148 literal: LITERALS,
149 type: TYPES,
150 built_in: BUILT_INS
151 },
152 contains: [
153 {
154 className: 'meta', // Actually pragma
155 begin: /\{\./,
156 end: /\.\}/,
157 relevance: 10
158 },
159 {
160 className: 'string',
161 begin: /[a-zA-Z]\w*"/,
162 end: /"/,
163 contains: [ { begin: /""/ } ]
164 },
165 {
166 className: 'string',
167 begin: /([a-zA-Z]\w*)?"""/,
168 end: /"""/
169 },
170 hljs.QUOTE_STRING_MODE,
171 {
172 className: 'type',
173 begin: /\b[A-Z]\w+\b/,
174 relevance: 0
175 },
176 {
177 className: 'number',
178 relevance: 0,
179 variants: [
180 { begin: /\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/ },
181 { begin: /\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/ },
182 { begin: /\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/ },
183 { begin: /\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/ }
184 ]
185 },
186 hljs.HASH_COMMENT_MODE
187 ]
188 };
189 }
190
191 return nim;
192
193 })();
194 ;
195 export default hljsGrammar;