@@ -0,0 +1,257 @@
3+# http://www.sublimetext.com/docs/3/syntax.html
11+ - match: '(\#\[\s*(TODO|todo)?)'
12+ comment: A multiline comment.
14+ 1: punctuation.definition.multi-comment.nim
15+ 2: invalid.illegal.TODO.nim
17+ - meta_scope: comment.line.number-sign.multi-comment.nim
20+ 1: punctuation.definition.multi-comment.nim
21+ 2: invalid.illegal.TODO.nim
23+ - match: (##\s*(TODO|todo)?).+$\n?
24+ comment: A documentation comment.
25+ scope: comment.line.number-sign.doc-comment.nim
27+ 1: punctuation.definition.doc-comment.nim
28+ 2: invalid.illegal.TODO.nim
30+ comment: An empty documentation comment.
31+ scope: comment.line.number-sign.doc-comment.empty.nim
33+ 1: punctuation.definition.doc-comment.empty.nim
34+ - match: (#\s*(TODO|todo)?).*$\n?
35+ comment: A regular comment
36+ scope: comment.line.number-sign.comment.nim
38+ 1: punctuation.definition.comment.nim
39+ 2: invalid.illegal.TODO.nim
48+ - meta_scope: string.something.nim
51+ - match: '([\w\x{80}-\x{10FFFF}]+)'
52+ scope: entity.other.attribute-name.pragma.nim
53+ - match: discard \"\"\"
54+ comment: A discarded triple string literal comment
56+ - meta_scope: comment.line.discarded.nim
59+ - match: '(?<![\w\x{80}-\x{10FFFF}])(\d[_\d]*((\.[_\d]+([eE][\+\-]?\d[_\d]*)?)|([eE][\+\-]?\d[_\d]*)))(''?([fF](32|64|128))|[fFdD])?'
60+ comment: A float literal
61+ scope: constant.numeric.float.decimal.nim
62+ - match: '(?<![\w\x{80}-\x{10FFFF}])(0[xX][0-9A-Fa-f][_0-9A-Fa-f]*)(''?(([iIuUfF](8|16|32|64))|[uUfFdD]))?'
63+ comment: A hexadecimal literal
64+ scope: constant.numeric.integer.hexadecimal.nim
65+ - match: '(?<![\w\x{80}-\x{10FFFF}])(0[ocC][0-7][_0-7]*)(''?(([iIuUfF](8|16|32|64))|[uUfFdD]))?'
66+ comment: A base-8 integer literal
67+ scope: constant.numeric.integer.octal.nim
68+ - match: '(?<![\w\x{80}-\x{10FFFF}])(0(b|B)[01][_01]*)(''?(([iIuUfF](8|16|32|64))|[uUfFdD]))?'
69+ comment: A base-2 integer literal
70+ scope: constant.numeric.integer.binary.nim
71+ - match: '(?<![\w\x{80}-\x{10FFFF}])(\d[_\d]*)(''?(([iIuUfF](8|16|32|64))|[uUfFdD]))?'
72+ comment: A base-10 integer literal
73+ scope: constant.numeric.integer.decimal.nim
74+ - match: '(?<![\w\x{80}-\x{10FFFF}])(true|false|inf|nil)(?![\w\x{80}-\x{10FFFF}])'
75+ comment: Language Constants.
76+ scope: constant.language.nim
77+ - match: (?:^|\s+|=)(when|if)\b
78+ comment: Primary branching keywords
80+ 1: keyword.control.primary.nim
84+ 1: control.variable.parameter.nim
86+ - include: scope:source.nim
87+ - match: (?:^|\s+|=)(case)\b
88+ comment: Primary branching keyword 'case'
90+ 1: keyword.control.primary.nim
94+ 1: control.variable.parameter.nim
96+ - include: scope:source.nim
97+ - match: (?:^|\s+)(of|else|elif)\b
98+ comment: Secondary branching keywords and their conditions
100+ 1: keyword.control.secondary.nim
104+ 1: control.variable.parameter.nim
106+ - include: scope:source.nim
107+ - match: '(?<![\w\x{80}-\x{10FFFF}])(await|block|break|continue|do|end|except|finally|raise|return|try|while|yield)(?![\w\x{80}-\x{10FFFF}])'
108+ comment: Keywords that affect program control flow or scope.
109+ scope: keyword.control.nim
110+ - match: '((?<![\w\x{80}-\x{10FFFF}])(and|in|is|isnot|not|notin|or|xor)(?![\w\x{80}-\x{10FFFF}]))'
111+ comment: Keyword boolean operators for expressions.
112+ scope: keyword.operator.boolean.nim
113+ - match: '((?<![\w\x{80}-\x{10FFFF}])(addr|as|atomic|bind|cast|const|converter|defer|discard|distinct|div|enum|export|include|let|mixin|object|of|ptr|ref|shl|shr|static|type|var)(?![\w\x{80}-\x{10FFFF}]))'
114+ comment: Other keywords.
115+ scope: keyword.other.nim
116+ - match: (\b()\b|(=|\+|-|\*|/|<|>|@|\$|~|&|%|!|\?|\^|\.|:|\\)+)
117+ comment: Generic operators for expressions.
118+ scope: keyword.operator.nim
120+ comment: in keyword in a 'for' loop
122+ 1: keyword.control.nim
124+ - meta_scope: meta.forloop.nim
127+ 1: keyword.control.nim
129+ - match: '\ [\w\x{80}-\x{10FFFF},]+\s+(in)\s+'
131+ 1: keyword.control.nim
132+ - include: scope:source.nim
133+ - match: '((import)\s+[\.|\w|\/]+,?)'
134+ comment: Import syntax
136+ 2: keyword.control.nim
137+ - match: '(from)\s+[\/\w]+\s+(?=import)'
139+ 1: keyword.control.nim
140+ - match: (var|let)\s*\(
141+ comment: Destructure syntax
143+ 1: keyword.other.nim
147+ 1: keyword.other.nim
149+ - match: '((?<![\w\x{80}-\x{10FFFF}])(generic|interface|lambda|out|shared|with|without)(?![\w\x{80}-\x{10FFFF}]))'
150+ comment: Invalid and unused keywords.
151+ scope: keyword.invalid.nim
152+ - match: '(?<![\w\x{80}-\x{10FFFF}])(new|GC_ref|GC_unref|assert|echo|defined|declared|newException|countup|countdown|len|high|low)(?![\w\x{80}-\x{10FFFF}])'
153+ comment: Common functions
154+ scope: keyword.other.common.function.nim
155+ - match: '(?<![\w\x{80}-\x{10FFFF}])(((uint|int|float)(8|16|32|64)?)|clong|culong|cchar|cschar|cshort|cint|csize|clonglong|cfloat|cdouble|clongdouble|cuchar|cushort|cuint|culonglong|cstringArray|bool|string|auto|cstring|char|byte|tobject|typedesc|stmt|expr|any|untyped|typed)(?![\w\x{80}-\x{10FFFF}])'
156+ comment: Built-in, concrete types.
157+ scope: storage.type.concrete.nim
158+ - match: '(?<![\w\x{80}-\x{10FFFF}])(range|array|seq|tuple|natural|set|ref|ptr|pointer)(?![\w\x{80}-\x{10FFFF}])'
159+ comment: Built-in, generic types.
160+ scope: storage.type.generic.nim
161+ - match: '(?<![\w\x{80}-\x{10FFFF}])(proc|iterator|method|template|macro)(?![\w\x{80}-\x{10FFFF}])'
162+ comment: Function types
163+ scope: storage.type.function.nim
164+ - match: '(?<![\w\x{80}-\x{10FFFF}])(openarray|varargs|void)(?![\w\x{80}-\x{10FFFF}])'
165+ comment: Special types.
166+ scope: storage.type.generic.nim
167+ - match: '(?<![\w\x{80}-\x{10FFFF}])([A-Z][A-Z0-9_]+)(?![\w\x{80}-\x{10FFFF}])'
168+ comment: Other constants.
169+ scope: support.constant.nim
170+ - match: '(?<![\w\x{80}-\x{10FFFF}])([A-Z]\w+)(?![\w\x{80}-\x{10FFFF}])'
171+ comment: Other types.
172+ scope: support.type.nim
173+ - match: '(?<![\w\x{80}-\x{10FFFF}])(\w+)(?![\w\x{80}-\x{10FFFF}])(?=\()'
174+ comment: Function call.
175+ scope: support.function.any-method.nim
177+ comment: (Raw) Triple Quoted String
179+ - meta_scope: string.quoted.triple.nim
180+ - match: '\"\"\"[^\"]'
183+ comment: Raw Double Quoted String
185+ - meta_scope: string.quoted.double.raw.nim
190+ comment: Double Quoted String
192+ - meta_scope: string.quoted.double.nim
195+ - include: escaped_char
197+ comment: Single quoted character literal
199+ - meta_scope: string.quoted.single.nim
203+ scope: invalid.illegal.character.nim
204+ - include: escaped_char
205+ - match: '([^\''][^\'']+?)'
206+ scope: invalid.illegal.character.nim
207+ - match: '([\w\x{80}-\x{10FFFF}\`]+)\s*(?=\(|\[.+?\]\s*\()'
208+ comment: Call syntax
210+ 1: support.function.any-method.nim
214+ 1: support.function.any-method.nim
216+ - include: scope:source.nim
217+ - match: '([\w\x{80}-\x{10FFFF}]+)(?=\s+[\w](?![\w\x{80}-\x{10FFFF}]+((?!\n)\s)+))'
218+ comment: Command syntax
220+ 1: support.function.any-method.nim
221+ - match: '([\w\x{80}-\x{10FFFF}]+)(?=\s+[\"\''\`])'
223+ 1: support.function.any-method.nim
224+ - match: (tmpl(i)?)(?=( (nim|html|xml|js|css|glsl|md))?\"\"\")
225+ comment: tmpl specifier
227+ 1: storage.type.function.nim
228+ 2: keyword.operator.nim
231+ scope: constant.character.escape.newline.nim
232+ - match: '\\[cC]|\\[rR]'
233+ scope: constant.character.escape.carriagereturn.nim
235+ scope: constant.character.escape.linefeed.nim
237+ scope: constant.character.escape.formfeed.nim
239+ scope: constant.character.escape.tabulator.nim
241+ scope: constant.character.escape.verticaltabulator.nim
243+ scope: constant.character.escape.double-quote.nim
245+ scope: constant.character.escape.single-quote.nim
247+ scope: constant.character.escape.chardecimalvalue.nim
249+ scope: constant.character.escape.alert.nim
251+ scope: constant.character.escape.backspace.nim
253+ scope: constant.character.escape.escape.nim
254+ - match: '\\[xX][0-9A-Fa-f]{2}'
255+ scope: constant.character.escape.hex.nim
257+ scope: constant.character.escape.backslash.nim