tm-grammars 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/LICENSE +22 -0
  2. package/NOTICE +6565 -0
  3. package/README.md +211 -0
  4. package/grammars/abap.json +380 -0
  5. package/grammars/actionscript-3.json +951 -0
  6. package/grammars/ada.json +3874 -0
  7. package/grammars/apache.json +562 -0
  8. package/grammars/apex.json +3203 -0
  9. package/grammars/apl.json +1479 -0
  10. package/grammars/applescript.json +1406 -0
  11. package/grammars/ara.json +428 -0
  12. package/grammars/asm.json +1741 -0
  13. package/grammars/astro.json +776 -0
  14. package/grammars/awk.json +388 -0
  15. package/grammars/ballerina.json +3768 -0
  16. package/grammars/bat.json +783 -0
  17. package/grammars/beancount.json +831 -0
  18. package/grammars/berry.json +172 -0
  19. package/grammars/bibtex.json +315 -0
  20. package/grammars/bicep.json +239 -0
  21. package/grammars/blade.json +3870 -0
  22. package/grammars/c.json +3552 -0
  23. package/grammars/cadence.json +738 -0
  24. package/grammars/clarity.json +877 -0
  25. package/grammars/clojure.json +426 -0
  26. package/grammars/cmake.json +143 -0
  27. package/grammars/cobol.json +1124 -0
  28. package/grammars/codeql.json +1540 -0
  29. package/grammars/coffee.json +1311 -0
  30. package/grammars/cpp-macro.json +9498 -0
  31. package/grammars/cpp.json +16635 -0
  32. package/grammars/crystal.json +1866 -0
  33. package/grammars/csharp.json +5722 -0
  34. package/grammars/css.json +1860 -0
  35. package/grammars/csv.json +46 -0
  36. package/grammars/cue.json +1128 -0
  37. package/grammars/cypher.json +353 -0
  38. package/grammars/d.json +3185 -0
  39. package/grammars/dart.json +522 -0
  40. package/grammars/dax.json +185 -0
  41. package/grammars/diff.json +155 -0
  42. package/grammars/docker.json +97 -0
  43. package/grammars/dream-maker.json +640 -0
  44. package/grammars/elixir.json +1014 -0
  45. package/grammars/elm.json +751 -0
  46. package/grammars/erb.json +156 -0
  47. package/grammars/erlang.json +1757 -0
  48. package/grammars/fish.json +189 -0
  49. package/grammars/fsharp.json +1831 -0
  50. package/grammars/gdresource.json +290 -0
  51. package/grammars/gdscript.json +969 -0
  52. package/grammars/gdshader.json +405 -0
  53. package/grammars/gherkin.json +133 -0
  54. package/grammars/git-commit.json +85 -0
  55. package/grammars/git-rebase.json +56 -0
  56. package/grammars/glimmer-js.json +98 -0
  57. package/grammars/glimmer-ts.json +98 -0
  58. package/grammars/glsl.json +57 -0
  59. package/grammars/gnuplot.json +892 -0
  60. package/grammars/go.json +1012 -0
  61. package/grammars/graphql.json +1295 -0
  62. package/grammars/groovy.json +1378 -0
  63. package/grammars/hack.json +2650 -0
  64. package/grammars/haml.json +598 -0
  65. package/grammars/handlebars.json +848 -0
  66. package/grammars/haskell.json +2431 -0
  67. package/grammars/hcl.json +787 -0
  68. package/grammars/hjson.json +821 -0
  69. package/grammars/hlsl.json +212 -0
  70. package/grammars/html.json +93 -0
  71. package/grammars/imba.json +2696 -0
  72. package/grammars/ini.json +108 -0
  73. package/grammars/java.json +1885 -0
  74. package/grammars/javascript.json +5984 -0
  75. package/grammars/jinja-html.json +16 -0
  76. package/grammars/jinja.json +345 -0
  77. package/grammars/jison.json +715 -0
  78. package/grammars/jsdoc.json +21 -0
  79. package/grammars/json.json +208 -0
  80. package/grammars/json5.json +244 -0
  81. package/grammars/jsonc.json +208 -0
  82. package/grammars/jsonl.json +208 -0
  83. package/grammars/jsonnet.json +211 -0
  84. package/grammars/jssm.json +159 -0
  85. package/grammars/jsx.json +5984 -0
  86. package/grammars/julia.json +1061 -0
  87. package/grammars/kotlin.json +580 -0
  88. package/grammars/kusto.json +687 -0
  89. package/grammars/latex.json +2395 -0
  90. package/grammars/less.json +5012 -0
  91. package/grammars/liquid.json +990 -0
  92. package/grammars/lisp.json +121 -0
  93. package/grammars/logo.json +55 -0
  94. package/grammars/lua.json +956 -0
  95. package/grammars/make.json +629 -0
  96. package/grammars/markdown.json +3066 -0
  97. package/grammars/marko.json +1344 -0
  98. package/grammars/matlab.json +1131 -0
  99. package/grammars/mdc.json +571 -0
  100. package/grammars/mdx.json +5629 -0
  101. package/grammars/mermaid.json +1382 -0
  102. package/grammars/mojo.json +4153 -0
  103. package/grammars/narrat.json +227 -0
  104. package/grammars/nextflow.json +298 -0
  105. package/grammars/nginx.json +2121 -0
  106. package/grammars/nim.json +1522 -0
  107. package/grammars/nix.json +1200 -0
  108. package/grammars/nushell.json +1047 -0
  109. package/grammars/objective-c.json +3750 -0
  110. package/grammars/objective-cpp.json +7242 -0
  111. package/grammars/ocaml.json +2967 -0
  112. package/grammars/pascal.json +154 -0
  113. package/grammars/perl.json +2971 -0
  114. package/grammars/php.json +4024 -0
  115. package/grammars/plsql.json +241 -0
  116. package/grammars/postcss.json +377 -0
  117. package/grammars/powerquery.json +349 -0
  118. package/grammars/powershell.json +1024 -0
  119. package/grammars/prisma.json +443 -0
  120. package/grammars/prolog.json +298 -0
  121. package/grammars/proto.json +507 -0
  122. package/grammars/pug.json +1033 -0
  123. package/grammars/puppet.json +777 -0
  124. package/grammars/purescript.json +871 -0
  125. package/grammars/python.json +4208 -0
  126. package/grammars/r.json +637 -0
  127. package/grammars/raku.json +310 -0
  128. package/grammars/razor.json +1813 -0
  129. package/grammars/reg.json +136 -0
  130. package/grammars/rel.json +200 -0
  131. package/grammars/riscv.json +298 -0
  132. package/grammars/rst.json +734 -0
  133. package/grammars/ruby.json +2769 -0
  134. package/grammars/rust.json +1171 -0
  135. package/grammars/sas.json +302 -0
  136. package/grammars/sass.json +618 -0
  137. package/grammars/scala.json +1313 -0
  138. package/grammars/scheme.json +384 -0
  139. package/grammars/scss.json +1874 -0
  140. package/grammars/shaderlab.json +199 -0
  141. package/grammars/shellscript.json +2025 -0
  142. package/grammars/shellsession.json +33 -0
  143. package/grammars/smalltalk.json +235 -0
  144. package/grammars/solidity.json +1210 -0
  145. package/grammars/sparql.json +45 -0
  146. package/grammars/splunk.json +91 -0
  147. package/grammars/sql.json +631 -0
  148. package/grammars/ssh-config.json +88 -0
  149. package/grammars/stata.json +3050 -0
  150. package/grammars/stylus.json +1208 -0
  151. package/grammars/svelte.json +1171 -0
  152. package/grammars/swift.json +4203 -0
  153. package/grammars/system-verilog.json +1063 -0
  154. package/grammars/tasl.json +292 -0
  155. package/grammars/tcl.json +291 -0
  156. package/grammars/tex.json +281 -0
  157. package/grammars/toml.json +431 -0
  158. package/grammars/tsx.json +5984 -0
  159. package/grammars/turtle.json +261 -0
  160. package/grammars/twig.json +1394 -0
  161. package/grammars/typescript.json +5735 -0
  162. package/grammars/v.json +1001 -0
  163. package/grammars/vb.json +232 -0
  164. package/grammars/verilog.json +305 -0
  165. package/grammars/vhdl.json +1484 -0
  166. package/grammars/viml.json +445 -0
  167. package/grammars/vue-html.json +559 -0
  168. package/grammars/vue.json +1237 -0
  169. package/grammars/vyper.json +5415 -0
  170. package/grammars/wasm.json +831 -0
  171. package/grammars/wenyan.json +129 -0
  172. package/grammars/wgsl.json +391 -0
  173. package/grammars/wolfram.json +2370 -0
  174. package/grammars/xml.json +382 -0
  175. package/grammars/xsl.json +89 -0
  176. package/grammars/yaml.json +616 -0
  177. package/grammars/zenscript.json +257 -0
  178. package/grammars/zig.json +312 -0
  179. package/index.d.ts +18 -0
  180. package/index.js +2165 -0
  181. package/package.json +46 -0
@@ -0,0 +1,2769 @@
1
+ {
2
+ "displayName": "Ruby",
3
+ "name": "ruby",
4
+ "patterns": [
5
+ {
6
+ "captures": {
7
+ "1": {
8
+ "name": "keyword.control.class.ruby"
9
+ },
10
+ "2": {
11
+ "name": "entity.name.type.class.ruby"
12
+ },
13
+ "3": {
14
+ "name": "keyword.operator.other.ruby"
15
+ },
16
+ "4": {
17
+ "name": "entity.other.inherited-class.ruby"
18
+ },
19
+ "5": {
20
+ "name": "keyword.operator.other.ruby"
21
+ },
22
+ "6": {
23
+ "name": "variable.other.object.ruby"
24
+ }
25
+ },
26
+ "match": "^\\s*(class)\\s+(?:([.a-zA-Z0-9_:]+)(?:\\s*(<)\\s*([.a-zA-Z0-9_:]+))?|(<<)\\s*([.a-zA-Z0-9_:]+))",
27
+ "name": "meta.class.ruby"
28
+ },
29
+ {
30
+ "captures": {
31
+ "1": {
32
+ "name": "keyword.control.module.ruby"
33
+ },
34
+ "2": {
35
+ "name": "entity.name.type.module.ruby"
36
+ },
37
+ "3": {
38
+ "name": "entity.other.inherited-class.module.first.ruby"
39
+ },
40
+ "4": {
41
+ "name": "punctuation.separator.inheritance.ruby"
42
+ },
43
+ "5": {
44
+ "name": "entity.other.inherited-class.module.second.ruby"
45
+ },
46
+ "6": {
47
+ "name": "punctuation.separator.inheritance.ruby"
48
+ },
49
+ "7": {
50
+ "name": "entity.other.inherited-class.module.third.ruby"
51
+ },
52
+ "8": {
53
+ "name": "punctuation.separator.inheritance.ruby"
54
+ }
55
+ },
56
+ "match": "^\\s*(module)\\s+(([A-Z]\\w*(::))?([A-Z]\\w*(::))?([A-Z]\\w*(::))*[A-Z]\\w*)",
57
+ "name": "meta.module.ruby"
58
+ },
59
+ {
60
+ "comment": "else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want.",
61
+ "match": "(?<!\\.)\\belse(\\s)+if\\b",
62
+ "name": "invalid.deprecated.ruby"
63
+ },
64
+ {
65
+ "captures": {
66
+ "1": {
67
+ "name": "punctuation.definition.constant.ruby"
68
+ }
69
+ },
70
+ "comment": "symbols as hash key (1.9 syntax)",
71
+ "match": "(?>[a-zA-Z_]\\w*(?>[?!])?)(:)(?!:)",
72
+ "name": "constant.other.symbol.hashkey.ruby"
73
+ },
74
+ {
75
+ "captures": {
76
+ "1": {
77
+ "name": "punctuation.definition.constant.ruby"
78
+ }
79
+ },
80
+ "comment": "symbols as hash key (1.8 syntax)",
81
+ "match": "(?<!:)(:)(?>[a-zA-Z_]\\w*(?>[?!])?)(?=\\s*=>)",
82
+ "name": "constant.other.symbol.hashkey.ruby"
83
+ },
84
+ {
85
+ "comment": "everything being a reserved word, not a value and needing a 'end' is a..",
86
+ "match": "(?<!\\.)\\b(BEGIN|begin|case|class|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\\b(?![?!])",
87
+ "name": "keyword.control.ruby"
88
+ },
89
+ {
90
+ "comment": "contextual smart pair support for block parameters",
91
+ "match": "(?<!\\.)\\bdo\\b",
92
+ "name": "keyword.control.start-block.ruby"
93
+ },
94
+ {
95
+ "comment": "contextual smart pair support",
96
+ "match": "(?<=\\{)(\\s+)",
97
+ "name": "meta.syntax.ruby.start-block"
98
+ },
99
+ {
100
+ "match": "(?<!\\.)\\b(alias|alias_method|block_given[?]|break|defined[?]|iterator[?]|next|redo|retry|return|super|undef|yield)(\\b|(?<=[?]))(?![?!])",
101
+ "name": "keyword.control.pseudo-method.ruby"
102
+ },
103
+ {
104
+ "match": "\\b(nil|true|false)\\b(?![?!])",
105
+ "name": "constant.language.ruby"
106
+ },
107
+ {
108
+ "match": "\\b(__(dir|FILE|LINE)__)\\b(?![?!])",
109
+ "name": "variable.language.ruby"
110
+ },
111
+ {
112
+ "begin": "^__END__\\n",
113
+ "captures": {
114
+ "0": {
115
+ "name": "string.unquoted.program-block.ruby"
116
+ }
117
+ },
118
+ "comment": "__END__ marker",
119
+ "contentName": "text.plain",
120
+ "end": "(?=not)impossible",
121
+ "patterns": [
122
+ {
123
+ "begin": "(?=<?xml|<(?i:html\\b)|!DOCTYPE (?i:html\\b))",
124
+ "end": "(?=not)impossible",
125
+ "name": "text.html.embedded.ruby",
126
+ "patterns": [
127
+ {
128
+ "include": "text.html.basic"
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "match": "\\b(self)\\b(?![?!])",
136
+ "name": "variable.language.self.ruby"
137
+ },
138
+ {
139
+ "comment": " everything being a method but having a special function is a..",
140
+ "match": "\\b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|private_class_method|module_function|public|public_class_method|protected|refine|using)\\b(?![?!])",
141
+ "name": "keyword.other.special-method.ruby"
142
+ },
143
+ {
144
+ "begin": "\\b(?<!\\.|::)(require|require_relative)\\b",
145
+ "captures": {
146
+ "1": {
147
+ "name": "keyword.other.special-method.ruby"
148
+ }
149
+ },
150
+ "end": "$|(?=#|\\})",
151
+ "name": "meta.require.ruby",
152
+ "patterns": [
153
+ {
154
+ "include": "$self"
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "captures": {
160
+ "1": {
161
+ "name": "punctuation.definition.variable.ruby"
162
+ }
163
+ },
164
+ "match": "(@)[a-zA-Z_]\\w*",
165
+ "name": "variable.other.readwrite.instance.ruby"
166
+ },
167
+ {
168
+ "captures": {
169
+ "1": {
170
+ "name": "punctuation.definition.variable.ruby"
171
+ }
172
+ },
173
+ "match": "(@@)[a-zA-Z_]\\w*",
174
+ "name": "variable.other.readwrite.class.ruby"
175
+ },
176
+ {
177
+ "captures": {
178
+ "1": {
179
+ "name": "punctuation.definition.variable.ruby"
180
+ }
181
+ },
182
+ "match": "(\\$)[a-zA-Z_]\\w*",
183
+ "name": "variable.other.readwrite.global.ruby"
184
+ },
185
+ {
186
+ "captures": {
187
+ "1": {
188
+ "name": "punctuation.definition.variable.ruby"
189
+ }
190
+ },
191
+ "match": "(\\$)(!|@|&|`|'|\\+|\\d+|~|=|/|\\\\|,|;|\\.|<|>|_|\\*|\\$|\\?|:|\"|-[0adFiIlpvw])",
192
+ "name": "variable.other.readwrite.global.pre-defined.ruby"
193
+ },
194
+ {
195
+ "begin": "\\b(ENV)\\[",
196
+ "beginCaptures": {
197
+ "1": {
198
+ "name": "variable.other.constant.ruby"
199
+ }
200
+ },
201
+ "end": "\\]",
202
+ "name": "meta.environment-variable.ruby",
203
+ "patterns": [
204
+ {
205
+ "include": "$self"
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "match": "\\b[A-Z]\\w*(?=((\\.|::)[A-Za-z]|\\[))",
211
+ "name": "support.class.ruby"
212
+ },
213
+ {
214
+ "match": "\\b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)(\\b|(?<=[?!]))(?![?!])",
215
+ "name": "support.function.kernel.ruby"
216
+ },
217
+ {
218
+ "match": "\\b[A-Z]\\w*\\b",
219
+ "name": "variable.other.constant.ruby"
220
+ },
221
+ {
222
+ "begin": "(?x)\n\t\t\t (?=def\\b) # an optimization to help Oniguruma fail fast\n\t\t\t (?<=^|\\s)(def)\\s+ # the def keyword\n\t\t\t ( (?>[a-zA-Z_]\\w*(?>\\.|::))? # a method name prefix\n\t\t\t (?>[a-zA-Z_]\\w*(?>[?!]|=(?!>))? # the method name\n\t\t\t |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\\|^]|\\*\\*?|=?~|[-+]@?|\\[\\]=?) ) # …or an operator method\n\t\t\t \\s*(\\() # the openning parenthesis for arguments\n\t\t\t ",
223
+ "beginCaptures": {
224
+ "1": {
225
+ "name": "keyword.control.def.ruby"
226
+ },
227
+ "2": {
228
+ "name": "entity.name.function.ruby"
229
+ },
230
+ "3": {
231
+ "name": "punctuation.definition.parameters.ruby"
232
+ }
233
+ },
234
+ "comment": "the method pattern comes from the symbol pattern, see there for a explaination",
235
+ "end": "\\)",
236
+ "endCaptures": {
237
+ "0": {
238
+ "name": "punctuation.definition.parameters.ruby"
239
+ }
240
+ },
241
+ "name": "meta.function.method.with-arguments.ruby",
242
+ "patterns": [
243
+ {
244
+ "begin": "(?=[&*_a-zA-Z])",
245
+ "end": "(?=[,)])",
246
+ "patterns": [
247
+ {
248
+ "captures": {
249
+ "1": {
250
+ "name": "storage.type.variable.ruby"
251
+ },
252
+ "2": {
253
+ "name": "constant.other.symbol.hashkey.parameter.function.ruby"
254
+ },
255
+ "3": {
256
+ "name": "punctuation.definition.constant.ruby"
257
+ },
258
+ "4": {
259
+ "name": "variable.parameter.function.ruby"
260
+ }
261
+ },
262
+ "match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))"
263
+ },
264
+ {
265
+ "include": "#parens"
266
+ },
267
+ {
268
+ "include": "#braces"
269
+ },
270
+ {
271
+ "include": "$self"
272
+ }
273
+ ]
274
+ }
275
+ ],
276
+ "repository": {
277
+ "braces": {
278
+ "begin": "\\{",
279
+ "beginCaptures": {
280
+ "0": {
281
+ "name": "punctuation.section.function.begin.ruby"
282
+ }
283
+ },
284
+ "end": "\\}",
285
+ "endCaptures": {
286
+ "0": {
287
+ "name": "punctuation.section.function.end.ruby"
288
+ }
289
+ },
290
+ "patterns": [
291
+ {
292
+ "include": "#parens"
293
+ },
294
+ {
295
+ "include": "#braces"
296
+ },
297
+ {
298
+ "include": "$self"
299
+ }
300
+ ]
301
+ },
302
+ "parens": {
303
+ "begin": "\\(",
304
+ "beginCaptures": {
305
+ "0": {
306
+ "name": "punctuation.section.function.begin.ruby"
307
+ }
308
+ },
309
+ "end": "\\)",
310
+ "endCaptures": {
311
+ "0": {
312
+ "name": "punctuation.section.function.end.ruby"
313
+ }
314
+ },
315
+ "patterns": [
316
+ {
317
+ "include": "#parens"
318
+ },
319
+ {
320
+ "include": "#braces"
321
+ },
322
+ {
323
+ "include": "$self"
324
+ }
325
+ ]
326
+ }
327
+ }
328
+ },
329
+ {
330
+ "begin": "(?x)\n\t\t\t (?=def\\b) # an optimization to help Oniguruma fail fast\n\t\t\t (?<=^|\\s)(def)\\s+ # the def keyword\n\t\t\t ( (?>[a-zA-Z_]\\w*(?>\\.|::))? # a method name prefix\n\t\t\t (?>[a-zA-Z_]\\w*(?>[?!]|=(?!>))? # the method name\n\t\t\t |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\\|^]|\\*\\*?|=?~|[-+]@?|\\[\\]=?) ) # …or an operator method\n\t\t\t [ \\t] # the space separating the arguments\n\t\t\t (?=[ \\t]*[^\\s#;]) # make sure arguments and not a comment follow\n\t\t\t ",
331
+ "beginCaptures": {
332
+ "1": {
333
+ "name": "keyword.control.def.ruby"
334
+ },
335
+ "2": {
336
+ "name": "entity.name.function.ruby"
337
+ }
338
+ },
339
+ "comment": "same as the previous rule, but without parentheses around the arguments",
340
+ "end": "$",
341
+ "name": "meta.function.method.with-arguments.ruby",
342
+ "patterns": [
343
+ {
344
+ "begin": "(?![\\s,])",
345
+ "end": "(?=,|$)",
346
+ "patterns": [
347
+ {
348
+ "captures": {
349
+ "1": {
350
+ "name": "storage.type.variable.ruby"
351
+ },
352
+ "2": {
353
+ "name": "constant.other.symbol.hashkey.parameter.function.ruby"
354
+ },
355
+ "3": {
356
+ "name": "punctuation.definition.constant.ruby"
357
+ },
358
+ "4": {
359
+ "name": "variable.parameter.function.ruby"
360
+ }
361
+ },
362
+ "match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))",
363
+ "name": "variable.parameter.function.ruby"
364
+ },
365
+ {
366
+ "include": "$self"
367
+ }
368
+ ]
369
+ }
370
+ ]
371
+ },
372
+ {
373
+ "captures": {
374
+ "1": {
375
+ "name": "keyword.control.def.ruby"
376
+ },
377
+ "3": {
378
+ "name": "entity.name.function.ruby"
379
+ }
380
+ },
381
+ "comment": " the optional name is just to catch the def also without a method-name",
382
+ "match": "(?x)\n\t\t\t (?=def\\b) # an optimization to help Oniguruma fail fast\n\t\t\t (?<=^|\\s)(def)\\b # the def keyword\n\t\t\t ( \\s+ # an optional group of whitespace followed by…\n\t\t\t ( (?>[a-zA-Z_]\\w*(?>\\.|::))? # a method name prefix\n\t\t\t (?>[a-zA-Z_]\\w*(?>[?!]|=(?!>))? # the method name\n\t\t\t |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\\|^]|\\*\\*?|=?~|[-+]@?|\\[\\]=?) ) )? # …or an operator method\n\t\t\t ",
383
+ "name": "meta.function.method.without-arguments.ruby"
384
+ },
385
+ {
386
+ "match": "\\b\\d(?>_?\\d)*(?=\\.\\d|[eE])(\\.\\d(?>_?\\d)*)?([eE][-+]?\\d(?>_?\\d)*)?r?i?\\b",
387
+ "name": "constant.numeric.float.ruby"
388
+ },
389
+ {
390
+ "match": "\\b(0|(0[dD]\\d|[1-9])(?>_?\\d)*)r?i?\\b",
391
+ "name": "constant.numeric.integer.ruby"
392
+ },
393
+ {
394
+ "match": "\\b0[xX]\\h(?>_?\\h)*r?i?\\b",
395
+ "name": "constant.numeric.hex.ruby"
396
+ },
397
+ {
398
+ "match": "\\b0[bB][01](?>_?[01])*r?i?\\b",
399
+ "name": "constant.numeric.binary.ruby"
400
+ },
401
+ {
402
+ "match": "\\b0([oO]?[0-7](?>_?[0-7])*)?r?i?\\b",
403
+ "name": "constant.numeric.octal.ruby"
404
+ },
405
+ {
406
+ "begin": ":'",
407
+ "captures": {
408
+ "0": {
409
+ "name": "punctuation.definition.constant.ruby"
410
+ }
411
+ },
412
+ "end": "'",
413
+ "name": "constant.other.symbol.single-quoted.ruby",
414
+ "patterns": [
415
+ {
416
+ "match": "\\\\['\\\\]",
417
+ "name": "constant.character.escape.ruby"
418
+ }
419
+ ]
420
+ },
421
+ {
422
+ "begin": ":\"",
423
+ "captures": {
424
+ "0": {
425
+ "name": "punctuation.definition.constant.ruby"
426
+ }
427
+ },
428
+ "end": "\"",
429
+ "name": "constant.other.symbol.double-quoted.ruby",
430
+ "patterns": [
431
+ {
432
+ "include": "#interpolated_ruby"
433
+ },
434
+ {
435
+ "include": "#escaped_char"
436
+ }
437
+ ]
438
+ },
439
+ {
440
+ "comment": "Needs higher precedence than regular expressions.",
441
+ "match": "(?<!\\()/=",
442
+ "name": "keyword.operator.assignment.augmented.ruby"
443
+ },
444
+ {
445
+ "begin": "'",
446
+ "beginCaptures": {
447
+ "0": {
448
+ "name": "punctuation.definition.string.begin.ruby"
449
+ }
450
+ },
451
+ "comment": "single quoted string (does not allow interpolation)",
452
+ "end": "'",
453
+ "endCaptures": {
454
+ "0": {
455
+ "name": "punctuation.definition.string.end.ruby"
456
+ }
457
+ },
458
+ "name": "string.quoted.single.ruby",
459
+ "patterns": [
460
+ {
461
+ "match": "\\\\'|\\\\\\\\",
462
+ "name": "constant.character.escape.ruby"
463
+ }
464
+ ]
465
+ },
466
+ {
467
+ "begin": "\"",
468
+ "beginCaptures": {
469
+ "0": {
470
+ "name": "punctuation.definition.string.begin.ruby"
471
+ }
472
+ },
473
+ "comment": "double quoted string (allows for interpolation)",
474
+ "end": "\"",
475
+ "endCaptures": {
476
+ "0": {
477
+ "name": "punctuation.definition.string.end.ruby"
478
+ }
479
+ },
480
+ "name": "string.quoted.double.ruby",
481
+ "patterns": [
482
+ {
483
+ "include": "#interpolated_ruby"
484
+ },
485
+ {
486
+ "include": "#escaped_char"
487
+ }
488
+ ]
489
+ },
490
+ {
491
+ "begin": "`",
492
+ "beginCaptures": {
493
+ "0": {
494
+ "name": "punctuation.definition.string.begin.ruby"
495
+ }
496
+ },
497
+ "comment": "execute string (allows for interpolation)",
498
+ "end": "`",
499
+ "endCaptures": {
500
+ "0": {
501
+ "name": "punctuation.definition.string.end.ruby"
502
+ }
503
+ },
504
+ "name": "string.interpolated.ruby",
505
+ "patterns": [
506
+ {
507
+ "include": "#interpolated_ruby"
508
+ },
509
+ {
510
+ "include": "#escaped_char"
511
+ }
512
+ ]
513
+ },
514
+ {
515
+ "include": "#percent_literals"
516
+ },
517
+ {
518
+ "begin": "(?x)\n\t\t\t (?:\n\t\t\t ^ # beginning of line\n\t\t\t | (?<= # or look-behind on:\n\t\t\t [=>~(?:\\[,|&;]\n\t\t\t | [\\s;]if\\s\t\t\t# keywords\n\t\t\t | [\\s;]elsif\\s\n\t\t\t | [\\s;]while\\s\n\t\t\t | [\\s;]unless\\s\n\t\t\t | [\\s;]when\\s\n\t\t\t | [\\s;]assert_match\\s\n\t\t\t | [\\s;]or\\s\t\t\t# boolean opperators\n\t\t\t | [\\s;]and\\s\n\t\t\t | [\\s;]not\\s\n\t\t\t | [\\s.]index\\s\t\t\t# methods\n\t\t\t | [\\s.]scan\\s\n\t\t\t | [\\s.]sub\\s\n\t\t\t | [\\s.]sub!\\s\n\t\t\t | [\\s.]gsub\\s\n\t\t\t | [\\s.]gsub!\\s\n\t\t\t | [\\s.]match\\s\n\t\t\t )\n\t\t\t | (?<= # or a look-behind with line anchor:\n\t\t\t ^when\\s # duplication necessary due to limits of regex\n\t\t\t | ^if\\s\n\t\t\t | ^elsif\\s\n\t\t\t | ^while\\s\n\t\t\t | ^unless\\s\n\t\t\t )\n\t\t\t )\n\t\t\t \\s*((/))(?![*+{}?])\n\t\t\t",
519
+ "captures": {
520
+ "1": {
521
+ "name": "string.regexp.classic.ruby"
522
+ },
523
+ "2": {
524
+ "name": "punctuation.definition.string.ruby"
525
+ }
526
+ },
527
+ "comment": "regular expressions (normal)\n\t\t\twe only start a regexp if the character before it (excluding whitespace)\n\t\t\tis what we think is before a regexp\n\t\t\t",
528
+ "contentName": "string.regexp.classic.ruby",
529
+ "end": "((/[eimnosux]*))",
530
+ "patterns": [
531
+ {
532
+ "include": "#regex_sub"
533
+ }
534
+ ]
535
+ },
536
+ {
537
+ "captures": {
538
+ "1": {
539
+ "name": "punctuation.definition.constant.ruby"
540
+ }
541
+ },
542
+ "comment": "symbols",
543
+ "match": "(?<!:)(:)(?>[a-zA-Z_]\\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[\\]=?|(@@?|\\$)[a-zA-Z_]\\w*)",
544
+ "name": "constant.other.symbol.ruby"
545
+ },
546
+ {
547
+ "begin": "^=begin",
548
+ "captures": {
549
+ "0": {
550
+ "name": "punctuation.definition.comment.ruby"
551
+ }
552
+ },
553
+ "comment": "multiline comments",
554
+ "end": "^=end",
555
+ "name": "comment.block.documentation.ruby"
556
+ },
557
+ {
558
+ "begin": "(^[ \\t]+)?(?=#)",
559
+ "beginCaptures": {
560
+ "1": {
561
+ "name": "punctuation.whitespace.comment.leading.ruby"
562
+ }
563
+ },
564
+ "end": "(?!\\G)",
565
+ "patterns": [
566
+ {
567
+ "begin": "#",
568
+ "beginCaptures": {
569
+ "0": {
570
+ "name": "punctuation.definition.comment.ruby"
571
+ }
572
+ },
573
+ "end": "\\n",
574
+ "name": "comment.line.number-sign.ruby"
575
+ }
576
+ ]
577
+ },
578
+ {
579
+ "comment": "\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1 ?\\x61\n\n\t\t\texamples (2nd alternation = octal):\n\t\t\t?\\0 ?\\07 ?\\017\n\n\t\t\texamples (3rd alternation = escaped):\n\t\t\t?\\n ?\\b\n\n\t\t\texamples (4th alternation = meta-ctrl):\n\t\t\t?\\C-a ?\\M-a ?\\C-\\M-\\C-\\M-a\n\n\t\t\texamples (4th alternation = normal):\n\t\t\t?a ?A ?0 \n\t\t\t?* ?\" ?( \n\t\t\t?. ?#\n\t\t\t\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t",
580
+ "match": "(?<!\\w)\\?(\\\\(x\\h{1,2}(?!\\h)\\b|0[0-7]{0,2}(?![0-7])\\b|[^x0MC])|(\\\\[MC]-)+\\w|[^\\s\\\\])",
581
+ "name": "constant.numeric.ruby"
582
+ },
583
+ {
584
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)HTML)\\b\\1))",
585
+ "comment": "Heredoc with embedded html",
586
+ "end": "(?!\\G)",
587
+ "name": "meta.embedded.block.html",
588
+ "patterns": [
589
+ {
590
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)HTML)\\b\\1)",
591
+ "beginCaptures": {
592
+ "0": {
593
+ "name": "punctuation.definition.string.begin.ruby"
594
+ }
595
+ },
596
+ "contentName": "text.html",
597
+ "end": "\\s*\\2$\\n?",
598
+ "endCaptures": {
599
+ "0": {
600
+ "name": "punctuation.definition.string.end.ruby"
601
+ }
602
+ },
603
+ "name": "string.unquoted.heredoc.ruby",
604
+ "patterns": [
605
+ {
606
+ "include": "#heredoc"
607
+ },
608
+ {
609
+ "include": "#interpolated_ruby"
610
+ },
611
+ {
612
+ "include": "text.html.basic"
613
+ },
614
+ {
615
+ "include": "#escaped_char"
616
+ }
617
+ ]
618
+ }
619
+ ]
620
+ },
621
+ {
622
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)XML)\\b\\1))",
623
+ "comment": "Heredoc with embedded xml",
624
+ "end": "(?!\\G)",
625
+ "name": "meta.embedded.block.xml",
626
+ "patterns": [
627
+ {
628
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)XML)\\b\\1)",
629
+ "beginCaptures": {
630
+ "0": {
631
+ "name": "punctuation.definition.string.begin.ruby"
632
+ }
633
+ },
634
+ "contentName": "text.xml",
635
+ "end": "\\s*\\2$\\n?",
636
+ "endCaptures": {
637
+ "0": {
638
+ "name": "punctuation.definition.string.end.ruby"
639
+ }
640
+ },
641
+ "name": "string.unquoted.heredoc.ruby",
642
+ "patterns": [
643
+ {
644
+ "include": "#heredoc"
645
+ },
646
+ {
647
+ "include": "#interpolated_ruby"
648
+ },
649
+ {
650
+ "include": "text.xml"
651
+ },
652
+ {
653
+ "include": "#escaped_char"
654
+ }
655
+ ]
656
+ }
657
+ ]
658
+ },
659
+ {
660
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)SQL)\\b\\1))",
661
+ "comment": "Heredoc with embedded sql",
662
+ "end": "(?!\\G)",
663
+ "name": "meta.embedded.block.sql",
664
+ "patterns": [
665
+ {
666
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)SQL)\\b\\1)",
667
+ "beginCaptures": {
668
+ "0": {
669
+ "name": "punctuation.definition.string.begin.ruby"
670
+ }
671
+ },
672
+ "contentName": "source.sql",
673
+ "end": "\\s*\\2$\\n?",
674
+ "endCaptures": {
675
+ "0": {
676
+ "name": "punctuation.definition.string.end.ruby"
677
+ }
678
+ },
679
+ "name": "string.unquoted.heredoc.ruby",
680
+ "patterns": [
681
+ {
682
+ "include": "#heredoc"
683
+ },
684
+ {
685
+ "include": "#interpolated_ruby"
686
+ },
687
+ {
688
+ "include": "source.sql"
689
+ },
690
+ {
691
+ "include": "#escaped_char"
692
+ }
693
+ ]
694
+ }
695
+ ]
696
+ },
697
+ {
698
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)CSS)\\b\\1))",
699
+ "comment": "Heredoc with embedded css",
700
+ "end": "(?!\\G)",
701
+ "name": "meta.embedded.block.css",
702
+ "patterns": [
703
+ {
704
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)CSS)\\b\\1)",
705
+ "beginCaptures": {
706
+ "0": {
707
+ "name": "punctuation.definition.string.begin.ruby"
708
+ }
709
+ },
710
+ "contentName": "source.css",
711
+ "end": "\\s*\\2$\\n?",
712
+ "endCaptures": {
713
+ "0": {
714
+ "name": "punctuation.definition.string.end.ruby"
715
+ }
716
+ },
717
+ "name": "string.unquoted.heredoc.ruby",
718
+ "patterns": [
719
+ {
720
+ "include": "#heredoc"
721
+ },
722
+ {
723
+ "include": "#interpolated_ruby"
724
+ },
725
+ {
726
+ "include": "source.css"
727
+ },
728
+ {
729
+ "include": "#escaped_char"
730
+ }
731
+ ]
732
+ }
733
+ ]
734
+ },
735
+ {
736
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)CPP)\\b\\1))",
737
+ "comment": "Heredoc with embedded c++",
738
+ "end": "(?!\\G)",
739
+ "name": "meta.embedded.block.c++",
740
+ "patterns": [
741
+ {
742
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)CPP)\\b\\1)",
743
+ "beginCaptures": {
744
+ "0": {
745
+ "name": "punctuation.definition.string.begin.ruby"
746
+ }
747
+ },
748
+ "contentName": "source.c++",
749
+ "end": "\\s*\\2$\\n?",
750
+ "endCaptures": {
751
+ "0": {
752
+ "name": "punctuation.definition.string.end.ruby"
753
+ }
754
+ },
755
+ "name": "string.unquoted.heredoc.ruby",
756
+ "patterns": [
757
+ {
758
+ "include": "#heredoc"
759
+ },
760
+ {
761
+ "include": "#interpolated_ruby"
762
+ },
763
+ {
764
+ "include": "source.c++"
765
+ },
766
+ {
767
+ "include": "#escaped_char"
768
+ }
769
+ ]
770
+ }
771
+ ]
772
+ },
773
+ {
774
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)C)\\b\\1))",
775
+ "comment": "Heredoc with embedded c",
776
+ "end": "(?!\\G)",
777
+ "name": "meta.embedded.block.c",
778
+ "patterns": [
779
+ {
780
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)C)\\b\\1)",
781
+ "beginCaptures": {
782
+ "0": {
783
+ "name": "punctuation.definition.string.begin.ruby"
784
+ }
785
+ },
786
+ "contentName": "source.c",
787
+ "end": "\\s*\\2$\\n?",
788
+ "endCaptures": {
789
+ "0": {
790
+ "name": "punctuation.definition.string.end.ruby"
791
+ }
792
+ },
793
+ "name": "string.unquoted.heredoc.ruby",
794
+ "patterns": [
795
+ {
796
+ "include": "#heredoc"
797
+ },
798
+ {
799
+ "include": "#interpolated_ruby"
800
+ },
801
+ {
802
+ "include": "source.c"
803
+ },
804
+ {
805
+ "include": "#escaped_char"
806
+ }
807
+ ]
808
+ }
809
+ ]
810
+ },
811
+ {
812
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1))",
813
+ "comment": "Heredoc with embedded javascript",
814
+ "end": "(?!\\G)",
815
+ "name": "meta.embedded.block.js",
816
+ "patterns": [
817
+ {
818
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1)",
819
+ "beginCaptures": {
820
+ "0": {
821
+ "name": "punctuation.definition.string.begin.ruby"
822
+ }
823
+ },
824
+ "contentName": "source.js",
825
+ "end": "\\s*\\2$\\n?",
826
+ "endCaptures": {
827
+ "0": {
828
+ "name": "punctuation.definition.string.end.ruby"
829
+ }
830
+ },
831
+ "name": "string.unquoted.heredoc.ruby",
832
+ "patterns": [
833
+ {
834
+ "include": "#heredoc"
835
+ },
836
+ {
837
+ "include": "#interpolated_ruby"
838
+ },
839
+ {
840
+ "include": "source.js"
841
+ },
842
+ {
843
+ "include": "#escaped_char"
844
+ }
845
+ ]
846
+ }
847
+ ]
848
+ },
849
+ {
850
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)JQUERY)\\b\\1))",
851
+ "comment": "Heredoc with embedded jQuery javascript",
852
+ "end": "(?!\\G)",
853
+ "name": "meta.embedded.block.js.jquery",
854
+ "patterns": [
855
+ {
856
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)JQUERY)\\b\\1)",
857
+ "beginCaptures": {
858
+ "0": {
859
+ "name": "punctuation.definition.string.begin.ruby"
860
+ }
861
+ },
862
+ "contentName": "source.js.jquery",
863
+ "end": "\\s*\\2$\\n?",
864
+ "endCaptures": {
865
+ "0": {
866
+ "name": "punctuation.definition.string.end.ruby"
867
+ }
868
+ },
869
+ "name": "string.unquoted.heredoc.ruby",
870
+ "patterns": [
871
+ {
872
+ "include": "#heredoc"
873
+ },
874
+ {
875
+ "include": "#interpolated_ruby"
876
+ },
877
+ {
878
+ "include": "source.js.jquery"
879
+ },
880
+ {
881
+ "include": "#escaped_char"
882
+ }
883
+ ]
884
+ }
885
+ ]
886
+ },
887
+ {
888
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1))",
889
+ "comment": "Heredoc with embedded shell",
890
+ "end": "(?!\\G)",
891
+ "name": "meta.embedded.block.shell",
892
+ "patterns": [
893
+ {
894
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1)",
895
+ "beginCaptures": {
896
+ "0": {
897
+ "name": "punctuation.definition.string.begin.ruby"
898
+ }
899
+ },
900
+ "contentName": "source.shell",
901
+ "end": "\\s*\\2$\\n?",
902
+ "endCaptures": {
903
+ "0": {
904
+ "name": "punctuation.definition.string.end.ruby"
905
+ }
906
+ },
907
+ "name": "string.unquoted.heredoc.ruby",
908
+ "patterns": [
909
+ {
910
+ "include": "#heredoc"
911
+ },
912
+ {
913
+ "include": "#interpolated_ruby"
914
+ },
915
+ {
916
+ "include": "source.shell"
917
+ },
918
+ {
919
+ "include": "#escaped_char"
920
+ }
921
+ ]
922
+ }
923
+ ]
924
+ },
925
+ {
926
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)LUA)\\b\\1))",
927
+ "comment": "Heredoc with embedded lua",
928
+ "end": "(?!\\G)",
929
+ "name": "meta.embedded.block.lua",
930
+ "patterns": [
931
+ {
932
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)LUA)\\b\\1)",
933
+ "beginCaptures": {
934
+ "0": {
935
+ "name": "punctuation.definition.string.begin.ruby"
936
+ }
937
+ },
938
+ "contentName": "source.lua",
939
+ "end": "\\s*\\2$\\n?",
940
+ "endCaptures": {
941
+ "0": {
942
+ "name": "punctuation.definition.string.end.ruby"
943
+ }
944
+ },
945
+ "name": "string.unquoted.heredoc.ruby",
946
+ "patterns": [
947
+ {
948
+ "include": "#heredoc"
949
+ },
950
+ {
951
+ "include": "#interpolated_ruby"
952
+ },
953
+ {
954
+ "include": "source.lua"
955
+ },
956
+ {
957
+ "include": "#escaped_char"
958
+ }
959
+ ]
960
+ }
961
+ ]
962
+ },
963
+ {
964
+ "begin": "(?=(?><<[-~](\"?)((?:[_\\w]+_|)RUBY)\\b\\1))",
965
+ "comment": "Heredoc with embedded ruby",
966
+ "end": "(?!\\G)",
967
+ "name": "meta.embedded.block.ruby",
968
+ "patterns": [
969
+ {
970
+ "begin": "(?><<[-~](\"?)((?:[_\\w]+_|)RUBY)\\b\\1)",
971
+ "beginCaptures": {
972
+ "0": {
973
+ "name": "punctuation.definition.string.begin.ruby"
974
+ }
975
+ },
976
+ "contentName": "source.ruby",
977
+ "end": "\\s*\\2$\\n?",
978
+ "endCaptures": {
979
+ "0": {
980
+ "name": "punctuation.definition.string.end.ruby"
981
+ }
982
+ },
983
+ "name": "string.unquoted.heredoc.ruby",
984
+ "patterns": [
985
+ {
986
+ "include": "#heredoc"
987
+ },
988
+ {
989
+ "include": "#interpolated_ruby"
990
+ },
991
+ {
992
+ "include": "source.ruby"
993
+ },
994
+ {
995
+ "include": "#escaped_char"
996
+ }
997
+ ]
998
+ }
999
+ ]
1000
+ },
1001
+ {
1002
+ "begin": "(?>=\\s*<<(\\w+))",
1003
+ "beginCaptures": {
1004
+ "0": {
1005
+ "name": "punctuation.definition.string.begin.ruby"
1006
+ }
1007
+ },
1008
+ "end": "^\\1$",
1009
+ "endCaptures": {
1010
+ "0": {
1011
+ "name": "punctuation.definition.string.end.ruby"
1012
+ }
1013
+ },
1014
+ "name": "string.unquoted.heredoc.ruby",
1015
+ "patterns": [
1016
+ {
1017
+ "include": "#heredoc"
1018
+ },
1019
+ {
1020
+ "include": "#interpolated_ruby"
1021
+ },
1022
+ {
1023
+ "include": "#escaped_char"
1024
+ }
1025
+ ]
1026
+ },
1027
+ {
1028
+ "begin": "(?><<[-~](\\w+))",
1029
+ "beginCaptures": {
1030
+ "0": {
1031
+ "name": "punctuation.definition.string.begin.ruby"
1032
+ }
1033
+ },
1034
+ "comment": "heredoc with indented terminator",
1035
+ "end": "\\s*\\1$",
1036
+ "endCaptures": {
1037
+ "0": {
1038
+ "name": "punctuation.definition.string.end.ruby"
1039
+ }
1040
+ },
1041
+ "name": "string.unquoted.heredoc.ruby",
1042
+ "patterns": [
1043
+ {
1044
+ "include": "#heredoc"
1045
+ },
1046
+ {
1047
+ "include": "#interpolated_ruby"
1048
+ },
1049
+ {
1050
+ "include": "#escaped_char"
1051
+ }
1052
+ ]
1053
+ },
1054
+ {
1055
+ "begin": "(?<=\\{|do|\\{\\s|do\\s)(\\|)",
1056
+ "captures": {
1057
+ "1": {
1058
+ "name": "punctuation.separator.arguments.ruby"
1059
+ }
1060
+ },
1061
+ "end": "(?<!\\|)(\\|)(?!\\|)",
1062
+ "patterns": [
1063
+ {
1064
+ "include": "$self"
1065
+ },
1066
+ {
1067
+ "match": "[_a-zA-Z][_a-zA-Z0-9]*",
1068
+ "name": "variable.other.block.ruby"
1069
+ },
1070
+ {
1071
+ "match": ",",
1072
+ "name": "punctuation.separator.variable.ruby"
1073
+ }
1074
+ ]
1075
+ },
1076
+ {
1077
+ "match": "=>",
1078
+ "name": "punctuation.separator.key-value"
1079
+ },
1080
+ {
1081
+ "match": "->",
1082
+ "name": "support.function.kernel.lambda.ruby"
1083
+ },
1084
+ {
1085
+ "match": "<<=|%=|&{1,2}=|\\*=|\\*\\*=|\\+=|-=|\\^=|\\|{1,2}=|<<",
1086
+ "name": "keyword.operator.assignment.augmented.ruby"
1087
+ },
1088
+ {
1089
+ "match": "<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \\t])\\?",
1090
+ "name": "keyword.operator.comparison.ruby"
1091
+ },
1092
+ {
1093
+ "match": "(?<!\\.)\\b(and|not|or)\\b(?![?!])",
1094
+ "name": "keyword.operator.logical.ruby"
1095
+ },
1096
+ {
1097
+ "comment": "Make sure this goes after assignment and comparison",
1098
+ "match": "(?<=^|[ \\t])!|&&|\\|\\||\\^",
1099
+ "name": "keyword.operator.logical.ruby"
1100
+ },
1101
+ {
1102
+ "captures": {
1103
+ "1": {
1104
+ "name": "punctuation.separator.method.ruby"
1105
+ }
1106
+ },
1107
+ "comment": "Safe navigation operator - Added in 2.3",
1108
+ "match": "(&\\.)\\s*(?![A-Z])"
1109
+ },
1110
+ {
1111
+ "match": "(%|&|\\*\\*|\\*|\\+|-|/)",
1112
+ "name": "keyword.operator.arithmetic.ruby"
1113
+ },
1114
+ {
1115
+ "match": "=",
1116
+ "name": "keyword.operator.assignment.ruby"
1117
+ },
1118
+ {
1119
+ "match": "\\||~|>>",
1120
+ "name": "keyword.operator.other.ruby"
1121
+ },
1122
+ {
1123
+ "match": ";",
1124
+ "name": "punctuation.separator.statement.ruby"
1125
+ },
1126
+ {
1127
+ "match": ",",
1128
+ "name": "punctuation.separator.object.ruby"
1129
+ },
1130
+ {
1131
+ "captures": {
1132
+ "1": {
1133
+ "name": "punctuation.separator.namespace.ruby"
1134
+ }
1135
+ },
1136
+ "comment": "Mark as namespace separator if double colons followed by capital letter",
1137
+ "match": "(::)\\s*(?=[A-Z])"
1138
+ },
1139
+ {
1140
+ "captures": {
1141
+ "1": {
1142
+ "name": "punctuation.separator.method.ruby"
1143
+ }
1144
+ },
1145
+ "comment": "Mark as method separator if double colons not followed by capital letter",
1146
+ "match": "(\\.|::)\\s*(?![A-Z])"
1147
+ },
1148
+ {
1149
+ "comment": "Must come after method and constant separators to prefer double colons",
1150
+ "match": ":",
1151
+ "name": "punctuation.separator.other.ruby"
1152
+ },
1153
+ {
1154
+ "match": "\\{",
1155
+ "name": "punctuation.section.scope.begin.ruby"
1156
+ },
1157
+ {
1158
+ "match": "\\}",
1159
+ "name": "punctuation.section.scope.end.ruby"
1160
+ },
1161
+ {
1162
+ "match": "\\[",
1163
+ "name": "punctuation.section.array.begin.ruby"
1164
+ },
1165
+ {
1166
+ "match": "\\]",
1167
+ "name": "punctuation.section.array.end.ruby"
1168
+ },
1169
+ {
1170
+ "match": "\\(|\\)",
1171
+ "name": "punctuation.section.function.ruby"
1172
+ }
1173
+ ],
1174
+ "repository": {
1175
+ "escaped_char": {
1176
+ "match": "\\\\(?:[0-7]{1,3}|x[\\da-fA-F]{1,2}|.)",
1177
+ "name": "constant.character.escape.ruby"
1178
+ },
1179
+ "heredoc": {
1180
+ "begin": "^<<[-~]?\\w+",
1181
+ "end": "$",
1182
+ "patterns": [
1183
+ {
1184
+ "include": "$self"
1185
+ }
1186
+ ]
1187
+ },
1188
+ "interpolated_ruby": {
1189
+ "patterns": [
1190
+ {
1191
+ "begin": "#\\{",
1192
+ "beginCaptures": {
1193
+ "0": {
1194
+ "name": "punctuation.section.embedded.begin.ruby"
1195
+ }
1196
+ },
1197
+ "contentName": "source.ruby",
1198
+ "end": "(\\})",
1199
+ "endCaptures": {
1200
+ "0": {
1201
+ "name": "punctuation.section.embedded.end.ruby"
1202
+ },
1203
+ "1": {
1204
+ "name": "source.ruby"
1205
+ }
1206
+ },
1207
+ "name": "meta.embedded.line.ruby",
1208
+ "patterns": [
1209
+ {
1210
+ "include": "#nest_curly_and_self"
1211
+ },
1212
+ {
1213
+ "include": "$self"
1214
+ }
1215
+ ],
1216
+ "repository": {
1217
+ "nest_curly_and_self": {
1218
+ "patterns": [
1219
+ {
1220
+ "begin": "\\{",
1221
+ "captures": {
1222
+ "0": {
1223
+ "name": "punctuation.section.scope.ruby"
1224
+ }
1225
+ },
1226
+ "end": "\\}",
1227
+ "patterns": [
1228
+ {
1229
+ "include": "#nest_curly_and_self"
1230
+ }
1231
+ ]
1232
+ },
1233
+ {
1234
+ "include": "$self"
1235
+ }
1236
+ ]
1237
+ }
1238
+ }
1239
+ },
1240
+ {
1241
+ "captures": {
1242
+ "1": {
1243
+ "name": "punctuation.definition.variable.ruby"
1244
+ }
1245
+ },
1246
+ "match": "(#@)[a-zA-Z_]\\w*",
1247
+ "name": "variable.other.readwrite.instance.ruby"
1248
+ },
1249
+ {
1250
+ "captures": {
1251
+ "1": {
1252
+ "name": "punctuation.definition.variable.ruby"
1253
+ }
1254
+ },
1255
+ "match": "(#@@)[a-zA-Z_]\\w*",
1256
+ "name": "variable.other.readwrite.class.ruby"
1257
+ },
1258
+ {
1259
+ "captures": {
1260
+ "1": {
1261
+ "name": "punctuation.definition.variable.ruby"
1262
+ }
1263
+ },
1264
+ "match": "(#\\$)[a-zA-Z_]\\w*",
1265
+ "name": "variable.other.readwrite.global.ruby"
1266
+ }
1267
+ ]
1268
+ },
1269
+ "percent_literals": {
1270
+ "patterns": [
1271
+ {
1272
+ "begin": "%i(?:([(\\[{<])|([^\\w\\s]|_))",
1273
+ "beginCaptures": {
1274
+ "0": {
1275
+ "name": "punctuation.section.array.begin.ruby"
1276
+ }
1277
+ },
1278
+ "end": "[)\\]}>]\\2|\\1\\2",
1279
+ "endCaptures": {
1280
+ "0": {
1281
+ "name": "punctuation.section.array.end.ruby"
1282
+ }
1283
+ },
1284
+ "name": "meta.array.symbol.ruby",
1285
+ "patterns": [
1286
+ {
1287
+ "begin": "\\G(?<=\\()(?!\\))",
1288
+ "end": "(?=\\))",
1289
+ "patterns": [
1290
+ {
1291
+ "include": "#parens"
1292
+ },
1293
+ {
1294
+ "include": "#symbol"
1295
+ }
1296
+ ]
1297
+ },
1298
+ {
1299
+ "begin": "\\G(?<=\\[)(?!\\])",
1300
+ "end": "(?=\\])",
1301
+ "patterns": [
1302
+ {
1303
+ "include": "#brackets"
1304
+ },
1305
+ {
1306
+ "include": "#symbol"
1307
+ }
1308
+ ]
1309
+ },
1310
+ {
1311
+ "begin": "\\G(?<=\\{)(?!\\})",
1312
+ "end": "(?=\\})",
1313
+ "patterns": [
1314
+ {
1315
+ "include": "#braces"
1316
+ },
1317
+ {
1318
+ "include": "#symbol"
1319
+ }
1320
+ ]
1321
+ },
1322
+ {
1323
+ "begin": "\\G(?<=<)(?!>)",
1324
+ "end": "(?=>)",
1325
+ "patterns": [
1326
+ {
1327
+ "include": "#angles"
1328
+ },
1329
+ {
1330
+ "include": "#symbol"
1331
+ }
1332
+ ]
1333
+ },
1334
+ {
1335
+ "include": "#symbol"
1336
+ }
1337
+ ],
1338
+ "repository": {
1339
+ "angles": {
1340
+ "patterns": [
1341
+ {
1342
+ "captures": {
1343
+ "0": {
1344
+ "name": "constant.character.escape.ruby"
1345
+ }
1346
+ },
1347
+ "match": "\\\\<|\\\\>",
1348
+ "name": "constant.other.symbol.ruby"
1349
+ },
1350
+ {
1351
+ "begin": "<",
1352
+ "captures": {
1353
+ "0": {
1354
+ "name": "constant.other.symbol.ruby"
1355
+ }
1356
+ },
1357
+ "end": ">",
1358
+ "patterns": [
1359
+ {
1360
+ "include": "#angles"
1361
+ },
1362
+ {
1363
+ "include": "#symbol"
1364
+ }
1365
+ ]
1366
+ }
1367
+ ]
1368
+ },
1369
+ "braces": {
1370
+ "patterns": [
1371
+ {
1372
+ "captures": {
1373
+ "0": {
1374
+ "name": "constant.character.escape.ruby"
1375
+ }
1376
+ },
1377
+ "match": "\\\\\\{|\\\\\\}",
1378
+ "name": "constant.other.symbol.ruby"
1379
+ },
1380
+ {
1381
+ "begin": "\\{",
1382
+ "captures": {
1383
+ "0": {
1384
+ "name": "constant.other.symbol.ruby"
1385
+ }
1386
+ },
1387
+ "end": "\\}",
1388
+ "patterns": [
1389
+ {
1390
+ "include": "#braces"
1391
+ },
1392
+ {
1393
+ "include": "#symbol"
1394
+ }
1395
+ ]
1396
+ }
1397
+ ]
1398
+ },
1399
+ "brackets": {
1400
+ "patterns": [
1401
+ {
1402
+ "captures": {
1403
+ "0": {
1404
+ "name": "constant.character.escape.ruby"
1405
+ }
1406
+ },
1407
+ "match": "\\\\\\[|\\\\\\]",
1408
+ "name": "constant.other.symbol.ruby"
1409
+ },
1410
+ {
1411
+ "begin": "\\[",
1412
+ "captures": {
1413
+ "0": {
1414
+ "name": "constant.other.symbol.ruby"
1415
+ }
1416
+ },
1417
+ "end": "\\]",
1418
+ "patterns": [
1419
+ {
1420
+ "include": "#brackets"
1421
+ },
1422
+ {
1423
+ "include": "#symbol"
1424
+ }
1425
+ ]
1426
+ }
1427
+ ]
1428
+ },
1429
+ "parens": {
1430
+ "patterns": [
1431
+ {
1432
+ "captures": {
1433
+ "0": {
1434
+ "name": "constant.character.escape.ruby"
1435
+ }
1436
+ },
1437
+ "match": "\\\\\\(|\\\\\\)",
1438
+ "name": "constant.other.symbol.ruby"
1439
+ },
1440
+ {
1441
+ "begin": "\\(",
1442
+ "captures": {
1443
+ "0": {
1444
+ "name": "constant.other.symbol.ruby"
1445
+ }
1446
+ },
1447
+ "end": "\\)",
1448
+ "patterns": [
1449
+ {
1450
+ "include": "#parens"
1451
+ },
1452
+ {
1453
+ "include": "#symbol"
1454
+ }
1455
+ ]
1456
+ }
1457
+ ]
1458
+ },
1459
+ "symbol": {
1460
+ "patterns": [
1461
+ {
1462
+ "captures": {
1463
+ "0": {
1464
+ "name": "constant.character.escape.ruby"
1465
+ }
1466
+ },
1467
+ "match": "\\\\\\\\|\\\\[ ]",
1468
+ "name": "constant.other.symbol.ruby"
1469
+ },
1470
+ {
1471
+ "match": "\\S\\w*",
1472
+ "name": "constant.other.symbol.ruby"
1473
+ }
1474
+ ]
1475
+ }
1476
+ }
1477
+ },
1478
+ {
1479
+ "begin": "%I(?:([(\\[{<])|([^\\w\\s]|_))",
1480
+ "beginCaptures": {
1481
+ "0": {
1482
+ "name": "punctuation.section.array.begin.ruby"
1483
+ }
1484
+ },
1485
+ "end": "[)\\]}>]\\2|\\1\\2",
1486
+ "endCaptures": {
1487
+ "0": {
1488
+ "name": "punctuation.section.array.end.ruby"
1489
+ }
1490
+ },
1491
+ "name": "meta.array.symbol.interpolated.ruby",
1492
+ "patterns": [
1493
+ {
1494
+ "begin": "\\G(?<=\\()(?!\\))",
1495
+ "end": "(?=\\))",
1496
+ "patterns": [
1497
+ {
1498
+ "include": "#parens"
1499
+ },
1500
+ {
1501
+ "include": "#symbol"
1502
+ }
1503
+ ]
1504
+ },
1505
+ {
1506
+ "begin": "\\G(?<=\\[)(?!\\])",
1507
+ "end": "(?=\\])",
1508
+ "patterns": [
1509
+ {
1510
+ "include": "#brackets"
1511
+ },
1512
+ {
1513
+ "include": "#symbol"
1514
+ }
1515
+ ]
1516
+ },
1517
+ {
1518
+ "begin": "\\G(?<=\\{)(?!\\})",
1519
+ "end": "(?=\\})",
1520
+ "patterns": [
1521
+ {
1522
+ "include": "#braces"
1523
+ },
1524
+ {
1525
+ "include": "#symbol"
1526
+ }
1527
+ ]
1528
+ },
1529
+ {
1530
+ "begin": "\\G(?<=<)(?!>)",
1531
+ "end": "(?=>)",
1532
+ "patterns": [
1533
+ {
1534
+ "include": "#angles"
1535
+ },
1536
+ {
1537
+ "include": "#symbol"
1538
+ }
1539
+ ]
1540
+ },
1541
+ {
1542
+ "include": "#symbol"
1543
+ }
1544
+ ],
1545
+ "repository": {
1546
+ "angles": {
1547
+ "patterns": [
1548
+ {
1549
+ "begin": "<",
1550
+ "captures": {
1551
+ "0": {
1552
+ "name": "constant.other.symbol.ruby"
1553
+ }
1554
+ },
1555
+ "end": ">",
1556
+ "patterns": [
1557
+ {
1558
+ "include": "#angles"
1559
+ },
1560
+ {
1561
+ "include": "#symbol"
1562
+ }
1563
+ ]
1564
+ }
1565
+ ]
1566
+ },
1567
+ "braces": {
1568
+ "patterns": [
1569
+ {
1570
+ "begin": "\\{",
1571
+ "captures": {
1572
+ "0": {
1573
+ "name": "constant.other.symbol.ruby"
1574
+ }
1575
+ },
1576
+ "end": "\\}",
1577
+ "patterns": [
1578
+ {
1579
+ "include": "#braces"
1580
+ },
1581
+ {
1582
+ "include": "#symbol"
1583
+ }
1584
+ ]
1585
+ }
1586
+ ]
1587
+ },
1588
+ "brackets": {
1589
+ "patterns": [
1590
+ {
1591
+ "begin": "\\[",
1592
+ "captures": {
1593
+ "0": {
1594
+ "name": "constant.other.symbol.ruby"
1595
+ }
1596
+ },
1597
+ "end": "\\]",
1598
+ "patterns": [
1599
+ {
1600
+ "include": "#brackets"
1601
+ },
1602
+ {
1603
+ "include": "#symbol"
1604
+ }
1605
+ ]
1606
+ }
1607
+ ]
1608
+ },
1609
+ "parens": {
1610
+ "patterns": [
1611
+ {
1612
+ "begin": "\\(",
1613
+ "captures": {
1614
+ "0": {
1615
+ "name": "constant.other.symbol.ruby"
1616
+ }
1617
+ },
1618
+ "end": "\\)",
1619
+ "patterns": [
1620
+ {
1621
+ "include": "#parens"
1622
+ },
1623
+ {
1624
+ "include": "#symbol"
1625
+ }
1626
+ ]
1627
+ }
1628
+ ]
1629
+ },
1630
+ "symbol": {
1631
+ "patterns": [
1632
+ {
1633
+ "begin": "(?=\\\\|#\\{)",
1634
+ "end": "(?!\\G)",
1635
+ "name": "constant.other.symbol.ruby",
1636
+ "patterns": [
1637
+ {
1638
+ "include": "#escaped_char"
1639
+ },
1640
+ {
1641
+ "include": "#interpolated_ruby"
1642
+ }
1643
+ ]
1644
+ },
1645
+ {
1646
+ "match": "\\S\\w*",
1647
+ "name": "constant.other.symbol.ruby"
1648
+ }
1649
+ ]
1650
+ }
1651
+ }
1652
+ },
1653
+ {
1654
+ "begin": "%q(?:([(\\[{<])|([^\\w\\s]|_))",
1655
+ "beginCaptures": {
1656
+ "0": {
1657
+ "name": "punctuation.definition.string.begin.ruby"
1658
+ }
1659
+ },
1660
+ "end": "[)\\]}>]\\2|\\1\\2",
1661
+ "endCaptures": {
1662
+ "0": {
1663
+ "name": "punctuation.definition.string.end.ruby"
1664
+ }
1665
+ },
1666
+ "name": "string.quoted.other.ruby",
1667
+ "patterns": [
1668
+ {
1669
+ "begin": "\\G(?<=\\()(?!\\))",
1670
+ "end": "(?=\\))",
1671
+ "patterns": [
1672
+ {
1673
+ "include": "#parens"
1674
+ }
1675
+ ]
1676
+ },
1677
+ {
1678
+ "begin": "\\G(?<=\\[)(?!\\])",
1679
+ "end": "(?=\\])",
1680
+ "patterns": [
1681
+ {
1682
+ "include": "#brackets"
1683
+ }
1684
+ ]
1685
+ },
1686
+ {
1687
+ "begin": "\\G(?<=\\{)(?!\\})",
1688
+ "end": "(?=\\})",
1689
+ "patterns": [
1690
+ {
1691
+ "include": "#braces"
1692
+ }
1693
+ ]
1694
+ },
1695
+ {
1696
+ "begin": "\\G(?<=<)(?!>)",
1697
+ "end": "(?=>)",
1698
+ "patterns": [
1699
+ {
1700
+ "include": "#angles"
1701
+ }
1702
+ ]
1703
+ }
1704
+ ],
1705
+ "repository": {
1706
+ "angles": {
1707
+ "patterns": [
1708
+ {
1709
+ "match": "\\\\<|\\\\>|\\\\\\\\",
1710
+ "name": "constant.character.escape.ruby"
1711
+ },
1712
+ {
1713
+ "begin": "<",
1714
+ "end": ">",
1715
+ "patterns": [
1716
+ {
1717
+ "include": "#angles"
1718
+ }
1719
+ ]
1720
+ }
1721
+ ]
1722
+ },
1723
+ "braces": {
1724
+ "patterns": [
1725
+ {
1726
+ "match": "\\\\\\{|\\\\\\}|\\\\\\\\",
1727
+ "name": "constant.character.escape.ruby"
1728
+ },
1729
+ {
1730
+ "begin": "\\{",
1731
+ "end": "\\}",
1732
+ "patterns": [
1733
+ {
1734
+ "include": "#braces"
1735
+ }
1736
+ ]
1737
+ }
1738
+ ]
1739
+ },
1740
+ "brackets": {
1741
+ "patterns": [
1742
+ {
1743
+ "match": "\\\\\\[|\\\\\\]|\\\\\\\\",
1744
+ "name": "constant.character.escape.ruby"
1745
+ },
1746
+ {
1747
+ "begin": "\\[",
1748
+ "end": "\\]",
1749
+ "patterns": [
1750
+ {
1751
+ "include": "#brackets"
1752
+ }
1753
+ ]
1754
+ }
1755
+ ]
1756
+ },
1757
+ "parens": {
1758
+ "patterns": [
1759
+ {
1760
+ "match": "\\\\\\(|\\\\\\)|\\\\\\\\",
1761
+ "name": "constant.character.escape.ruby"
1762
+ },
1763
+ {
1764
+ "begin": "\\(",
1765
+ "end": "\\)",
1766
+ "patterns": [
1767
+ {
1768
+ "include": "#parens"
1769
+ }
1770
+ ]
1771
+ }
1772
+ ]
1773
+ }
1774
+ }
1775
+ },
1776
+ {
1777
+ "begin": "%Q?(?:([(\\[{<])|([^\\w\\s=]|_))",
1778
+ "beginCaptures": {
1779
+ "0": {
1780
+ "name": "punctuation.definition.string.begin.ruby"
1781
+ }
1782
+ },
1783
+ "end": "[)\\]}>]\\2|\\1\\2",
1784
+ "endCaptures": {
1785
+ "0": {
1786
+ "name": "punctuation.definition.string.end.ruby"
1787
+ }
1788
+ },
1789
+ "name": "string.quoted.other.interpolated.ruby",
1790
+ "patterns": [
1791
+ {
1792
+ "begin": "\\G(?<=\\()(?!\\))",
1793
+ "end": "(?=\\))",
1794
+ "patterns": [
1795
+ {
1796
+ "include": "#parens"
1797
+ }
1798
+ ]
1799
+ },
1800
+ {
1801
+ "begin": "\\G(?<=\\[)(?!\\])",
1802
+ "end": "(?=\\])",
1803
+ "patterns": [
1804
+ {
1805
+ "include": "#brackets"
1806
+ }
1807
+ ]
1808
+ },
1809
+ {
1810
+ "begin": "\\G(?<=\\{)(?!\\})",
1811
+ "end": "(?=\\})",
1812
+ "patterns": [
1813
+ {
1814
+ "include": "#braces"
1815
+ }
1816
+ ]
1817
+ },
1818
+ {
1819
+ "begin": "\\G(?<=<)(?!>)",
1820
+ "end": "(?=>)",
1821
+ "patterns": [
1822
+ {
1823
+ "include": "#angles"
1824
+ }
1825
+ ]
1826
+ },
1827
+ {
1828
+ "include": "#escaped_char"
1829
+ },
1830
+ {
1831
+ "include": "#interpolated_ruby"
1832
+ }
1833
+ ],
1834
+ "repository": {
1835
+ "angles": {
1836
+ "patterns": [
1837
+ {
1838
+ "include": "#escaped_char"
1839
+ },
1840
+ {
1841
+ "include": "#interpolated_ruby"
1842
+ },
1843
+ {
1844
+ "begin": "<",
1845
+ "end": ">",
1846
+ "patterns": [
1847
+ {
1848
+ "include": "#angles"
1849
+ }
1850
+ ]
1851
+ }
1852
+ ]
1853
+ },
1854
+ "braces": {
1855
+ "patterns": [
1856
+ {
1857
+ "include": "#escaped_char"
1858
+ },
1859
+ {
1860
+ "include": "#interpolated_ruby"
1861
+ },
1862
+ {
1863
+ "begin": "\\{",
1864
+ "end": "\\}",
1865
+ "patterns": [
1866
+ {
1867
+ "include": "#braces"
1868
+ }
1869
+ ]
1870
+ }
1871
+ ]
1872
+ },
1873
+ "brackets": {
1874
+ "patterns": [
1875
+ {
1876
+ "include": "#escaped_char"
1877
+ },
1878
+ {
1879
+ "include": "#interpolated_ruby"
1880
+ },
1881
+ {
1882
+ "begin": "\\[",
1883
+ "end": "\\]",
1884
+ "patterns": [
1885
+ {
1886
+ "include": "#brackets"
1887
+ }
1888
+ ]
1889
+ }
1890
+ ]
1891
+ },
1892
+ "parens": {
1893
+ "patterns": [
1894
+ {
1895
+ "include": "#escaped_char"
1896
+ },
1897
+ {
1898
+ "include": "#interpolated_ruby"
1899
+ },
1900
+ {
1901
+ "begin": "\\(",
1902
+ "end": "\\)",
1903
+ "patterns": [
1904
+ {
1905
+ "include": "#parens"
1906
+ }
1907
+ ]
1908
+ }
1909
+ ]
1910
+ }
1911
+ }
1912
+ },
1913
+ {
1914
+ "begin": "%r(?:([(\\[{<])|([^\\w\\s]|_))",
1915
+ "beginCaptures": {
1916
+ "0": {
1917
+ "name": "punctuation.definition.string.begin.ruby"
1918
+ }
1919
+ },
1920
+ "end": "([)\\]}>]\\2|\\1\\2)[eimnosux]*",
1921
+ "endCaptures": {
1922
+ "0": {
1923
+ "name": "punctuation.definition.string.end.ruby"
1924
+ }
1925
+ },
1926
+ "name": "string.regexp.percent.ruby",
1927
+ "patterns": [
1928
+ {
1929
+ "begin": "\\G(?<=\\()(?!\\))",
1930
+ "end": "(?=\\))",
1931
+ "patterns": [
1932
+ {
1933
+ "include": "#parens"
1934
+ }
1935
+ ]
1936
+ },
1937
+ {
1938
+ "begin": "\\G(?<=\\[)(?!\\])",
1939
+ "end": "(?=\\])",
1940
+ "patterns": [
1941
+ {
1942
+ "include": "#brackets"
1943
+ }
1944
+ ]
1945
+ },
1946
+ {
1947
+ "begin": "\\G(?<=\\{)(?!\\})",
1948
+ "end": "(?=\\})",
1949
+ "patterns": [
1950
+ {
1951
+ "include": "#braces"
1952
+ }
1953
+ ]
1954
+ },
1955
+ {
1956
+ "begin": "\\G(?<=<)(?!>)",
1957
+ "end": "(?=>)",
1958
+ "patterns": [
1959
+ {
1960
+ "include": "#angles"
1961
+ }
1962
+ ]
1963
+ },
1964
+ {
1965
+ "include": "#regex_sub"
1966
+ }
1967
+ ],
1968
+ "repository": {
1969
+ "angles": {
1970
+ "patterns": [
1971
+ {
1972
+ "include": "#regex_sub"
1973
+ },
1974
+ {
1975
+ "begin": "<",
1976
+ "end": ">",
1977
+ "patterns": [
1978
+ {
1979
+ "include": "#angles"
1980
+ }
1981
+ ]
1982
+ }
1983
+ ]
1984
+ },
1985
+ "braces": {
1986
+ "patterns": [
1987
+ {
1988
+ "include": "#regex_sub"
1989
+ },
1990
+ {
1991
+ "begin": "\\{",
1992
+ "end": "\\}",
1993
+ "patterns": [
1994
+ {
1995
+ "include": "#braces"
1996
+ }
1997
+ ]
1998
+ }
1999
+ ]
2000
+ },
2001
+ "brackets": {
2002
+ "patterns": [
2003
+ {
2004
+ "include": "#regex_sub"
2005
+ },
2006
+ {
2007
+ "begin": "\\[",
2008
+ "end": "\\]",
2009
+ "patterns": [
2010
+ {
2011
+ "include": "#brackets"
2012
+ }
2013
+ ]
2014
+ }
2015
+ ]
2016
+ },
2017
+ "parens": {
2018
+ "patterns": [
2019
+ {
2020
+ "include": "#regex_sub"
2021
+ },
2022
+ {
2023
+ "begin": "\\(",
2024
+ "end": "\\)",
2025
+ "patterns": [
2026
+ {
2027
+ "include": "#parens"
2028
+ }
2029
+ ]
2030
+ }
2031
+ ]
2032
+ }
2033
+ }
2034
+ },
2035
+ {
2036
+ "begin": "%s(?:([(\\[{<])|([^\\w\\s]|_))",
2037
+ "beginCaptures": {
2038
+ "0": {
2039
+ "name": "punctuation.definition.constant.begin.ruby"
2040
+ }
2041
+ },
2042
+ "end": "[)\\]}>]\\2|\\1\\2",
2043
+ "endCaptures": {
2044
+ "0": {
2045
+ "name": "punctuation.definition.constant.end.ruby"
2046
+ }
2047
+ },
2048
+ "name": "constant.other.symbol.percent.ruby",
2049
+ "patterns": [
2050
+ {
2051
+ "begin": "\\G(?<=\\()(?!\\))",
2052
+ "end": "(?=\\))",
2053
+ "patterns": [
2054
+ {
2055
+ "include": "#parens"
2056
+ }
2057
+ ]
2058
+ },
2059
+ {
2060
+ "begin": "\\G(?<=\\[)(?!\\])",
2061
+ "end": "(?=\\])",
2062
+ "patterns": [
2063
+ {
2064
+ "include": "#brackets"
2065
+ }
2066
+ ]
2067
+ },
2068
+ {
2069
+ "begin": "\\G(?<=\\{)(?!\\})",
2070
+ "end": "(?=\\})",
2071
+ "patterns": [
2072
+ {
2073
+ "include": "#braces"
2074
+ }
2075
+ ]
2076
+ },
2077
+ {
2078
+ "begin": "\\G(?<=<)(?!>)",
2079
+ "end": "(?=>)",
2080
+ "patterns": [
2081
+ {
2082
+ "include": "#angles"
2083
+ }
2084
+ ]
2085
+ }
2086
+ ],
2087
+ "repository": {
2088
+ "angles": {
2089
+ "patterns": [
2090
+ {
2091
+ "match": "\\\\<|\\\\>|\\\\\\\\",
2092
+ "name": "constant.character.escape.ruby"
2093
+ },
2094
+ {
2095
+ "begin": "<",
2096
+ "end": ">",
2097
+ "patterns": [
2098
+ {
2099
+ "include": "#angles"
2100
+ }
2101
+ ]
2102
+ }
2103
+ ]
2104
+ },
2105
+ "braces": {
2106
+ "patterns": [
2107
+ {
2108
+ "match": "\\\\\\{|\\\\\\}|\\\\\\\\",
2109
+ "name": "constant.character.escape.ruby"
2110
+ },
2111
+ {
2112
+ "begin": "\\{",
2113
+ "end": "\\}",
2114
+ "patterns": [
2115
+ {
2116
+ "include": "#braces"
2117
+ }
2118
+ ]
2119
+ }
2120
+ ]
2121
+ },
2122
+ "brackets": {
2123
+ "patterns": [
2124
+ {
2125
+ "match": "\\\\\\[|\\\\\\]|\\\\\\\\",
2126
+ "name": "constant.character.escape.ruby"
2127
+ },
2128
+ {
2129
+ "begin": "\\[",
2130
+ "end": "\\]",
2131
+ "patterns": [
2132
+ {
2133
+ "include": "#brackets"
2134
+ }
2135
+ ]
2136
+ }
2137
+ ]
2138
+ },
2139
+ "parens": {
2140
+ "patterns": [
2141
+ {
2142
+ "match": "\\\\\\(|\\\\\\)|\\\\\\\\",
2143
+ "name": "constant.character.escape.ruby"
2144
+ },
2145
+ {
2146
+ "begin": "\\(",
2147
+ "end": "\\)",
2148
+ "patterns": [
2149
+ {
2150
+ "include": "#parens"
2151
+ }
2152
+ ]
2153
+ }
2154
+ ]
2155
+ }
2156
+ }
2157
+ },
2158
+ {
2159
+ "begin": "%w(?:([(\\[{<])|([^\\w\\s]|_))",
2160
+ "beginCaptures": {
2161
+ "0": {
2162
+ "name": "punctuation.section.array.begin.ruby"
2163
+ }
2164
+ },
2165
+ "end": "[)\\]}>]\\2|\\1\\2",
2166
+ "endCaptures": {
2167
+ "0": {
2168
+ "name": "punctuation.section.array.end.ruby"
2169
+ }
2170
+ },
2171
+ "name": "meta.array.string.ruby",
2172
+ "patterns": [
2173
+ {
2174
+ "begin": "\\G(?<=\\()(?!\\))",
2175
+ "end": "(?=\\))",
2176
+ "patterns": [
2177
+ {
2178
+ "include": "#parens"
2179
+ },
2180
+ {
2181
+ "include": "#string"
2182
+ }
2183
+ ]
2184
+ },
2185
+ {
2186
+ "begin": "\\G(?<=\\[)(?!\\])",
2187
+ "end": "(?=\\])",
2188
+ "patterns": [
2189
+ {
2190
+ "include": "#brackets"
2191
+ },
2192
+ {
2193
+ "include": "#string"
2194
+ }
2195
+ ]
2196
+ },
2197
+ {
2198
+ "begin": "\\G(?<=\\{)(?!\\})",
2199
+ "end": "(?=\\})",
2200
+ "patterns": [
2201
+ {
2202
+ "include": "#braces"
2203
+ },
2204
+ {
2205
+ "include": "#string"
2206
+ }
2207
+ ]
2208
+ },
2209
+ {
2210
+ "begin": "\\G(?<=<)(?!>)",
2211
+ "end": "(?=>)",
2212
+ "patterns": [
2213
+ {
2214
+ "include": "#angles"
2215
+ },
2216
+ {
2217
+ "include": "#string"
2218
+ }
2219
+ ]
2220
+ },
2221
+ {
2222
+ "include": "#string"
2223
+ }
2224
+ ],
2225
+ "repository": {
2226
+ "angles": {
2227
+ "patterns": [
2228
+ {
2229
+ "captures": {
2230
+ "0": {
2231
+ "name": "constant.character.escape.ruby"
2232
+ }
2233
+ },
2234
+ "match": "\\\\<|\\\\>",
2235
+ "name": "string.other.ruby"
2236
+ },
2237
+ {
2238
+ "begin": "<",
2239
+ "captures": {
2240
+ "0": {
2241
+ "name": "string.other.ruby"
2242
+ }
2243
+ },
2244
+ "end": ">",
2245
+ "patterns": [
2246
+ {
2247
+ "include": "#angles"
2248
+ },
2249
+ {
2250
+ "include": "#string"
2251
+ }
2252
+ ]
2253
+ }
2254
+ ]
2255
+ },
2256
+ "braces": {
2257
+ "patterns": [
2258
+ {
2259
+ "captures": {
2260
+ "0": {
2261
+ "name": "constant.character.escape.ruby"
2262
+ }
2263
+ },
2264
+ "match": "\\\\\\{|\\\\\\}",
2265
+ "name": "string.other.ruby"
2266
+ },
2267
+ {
2268
+ "begin": "\\{",
2269
+ "captures": {
2270
+ "0": {
2271
+ "name": "string.other.ruby"
2272
+ }
2273
+ },
2274
+ "end": "\\}",
2275
+ "patterns": [
2276
+ {
2277
+ "include": "#braces"
2278
+ },
2279
+ {
2280
+ "include": "#string"
2281
+ }
2282
+ ]
2283
+ }
2284
+ ]
2285
+ },
2286
+ "brackets": {
2287
+ "patterns": [
2288
+ {
2289
+ "captures": {
2290
+ "0": {
2291
+ "name": "constant.character.escape.ruby"
2292
+ }
2293
+ },
2294
+ "match": "\\\\\\[|\\\\\\]",
2295
+ "name": "string.other.ruby"
2296
+ },
2297
+ {
2298
+ "begin": "\\[",
2299
+ "captures": {
2300
+ "0": {
2301
+ "name": "string.other.ruby"
2302
+ }
2303
+ },
2304
+ "end": "\\]",
2305
+ "patterns": [
2306
+ {
2307
+ "include": "#brackets"
2308
+ },
2309
+ {
2310
+ "include": "#string"
2311
+ }
2312
+ ]
2313
+ }
2314
+ ]
2315
+ },
2316
+ "parens": {
2317
+ "patterns": [
2318
+ {
2319
+ "captures": {
2320
+ "0": {
2321
+ "name": "constant.character.escape.ruby"
2322
+ }
2323
+ },
2324
+ "match": "\\\\\\(|\\\\\\)",
2325
+ "name": "string.other.ruby"
2326
+ },
2327
+ {
2328
+ "begin": "\\(",
2329
+ "captures": {
2330
+ "0": {
2331
+ "name": "string.other.ruby"
2332
+ }
2333
+ },
2334
+ "end": "\\)",
2335
+ "patterns": [
2336
+ {
2337
+ "include": "#parens"
2338
+ },
2339
+ {
2340
+ "include": "#string"
2341
+ }
2342
+ ]
2343
+ }
2344
+ ]
2345
+ },
2346
+ "string": {
2347
+ "patterns": [
2348
+ {
2349
+ "captures": {
2350
+ "0": {
2351
+ "name": "constant.character.escape.ruby"
2352
+ }
2353
+ },
2354
+ "match": "\\\\\\\\|\\\\[ ]",
2355
+ "name": "string.other.ruby"
2356
+ },
2357
+ {
2358
+ "match": "\\S\\w*",
2359
+ "name": "string.other.ruby"
2360
+ }
2361
+ ]
2362
+ }
2363
+ }
2364
+ },
2365
+ {
2366
+ "begin": "%W(?:([(\\[{<])|([^\\w\\s]|_))",
2367
+ "beginCaptures": {
2368
+ "0": {
2369
+ "name": "punctuation.section.array.begin.ruby"
2370
+ }
2371
+ },
2372
+ "end": "[)\\]}>]\\2|\\1\\2",
2373
+ "endCaptures": {
2374
+ "0": {
2375
+ "name": "punctuation.section.array.end.ruby"
2376
+ }
2377
+ },
2378
+ "name": "meta.array.string.interpolated.ruby",
2379
+ "patterns": [
2380
+ {
2381
+ "begin": "\\G(?<=\\()(?!\\))",
2382
+ "end": "(?=\\))",
2383
+ "patterns": [
2384
+ {
2385
+ "include": "#parens"
2386
+ },
2387
+ {
2388
+ "include": "#string"
2389
+ }
2390
+ ]
2391
+ },
2392
+ {
2393
+ "begin": "\\G(?<=\\[)(?!\\])",
2394
+ "end": "(?=\\])",
2395
+ "patterns": [
2396
+ {
2397
+ "include": "#brackets"
2398
+ },
2399
+ {
2400
+ "include": "#string"
2401
+ }
2402
+ ]
2403
+ },
2404
+ {
2405
+ "begin": "\\G(?<=\\{)(?!\\})",
2406
+ "end": "(?=\\})",
2407
+ "patterns": [
2408
+ {
2409
+ "include": "#braces"
2410
+ },
2411
+ {
2412
+ "include": "#string"
2413
+ }
2414
+ ]
2415
+ },
2416
+ {
2417
+ "begin": "\\G(?<=<)(?!>)",
2418
+ "end": "(?=>)",
2419
+ "patterns": [
2420
+ {
2421
+ "include": "#angles"
2422
+ },
2423
+ {
2424
+ "include": "#string"
2425
+ }
2426
+ ]
2427
+ },
2428
+ {
2429
+ "include": "#string"
2430
+ }
2431
+ ],
2432
+ "repository": {
2433
+ "angles": {
2434
+ "patterns": [
2435
+ {
2436
+ "begin": "<",
2437
+ "captures": {
2438
+ "0": {
2439
+ "name": "string.other.ruby"
2440
+ }
2441
+ },
2442
+ "end": ">",
2443
+ "patterns": [
2444
+ {
2445
+ "include": "#angles"
2446
+ },
2447
+ {
2448
+ "include": "#string"
2449
+ }
2450
+ ]
2451
+ }
2452
+ ]
2453
+ },
2454
+ "braces": {
2455
+ "patterns": [
2456
+ {
2457
+ "begin": "\\{",
2458
+ "captures": {
2459
+ "0": {
2460
+ "name": "string.other.ruby"
2461
+ }
2462
+ },
2463
+ "end": "\\}",
2464
+ "patterns": [
2465
+ {
2466
+ "include": "#braces"
2467
+ },
2468
+ {
2469
+ "include": "#string"
2470
+ }
2471
+ ]
2472
+ }
2473
+ ]
2474
+ },
2475
+ "brackets": {
2476
+ "patterns": [
2477
+ {
2478
+ "begin": "\\[",
2479
+ "captures": {
2480
+ "0": {
2481
+ "name": "string.other.ruby"
2482
+ }
2483
+ },
2484
+ "end": "\\]",
2485
+ "patterns": [
2486
+ {
2487
+ "include": "#brackets"
2488
+ },
2489
+ {
2490
+ "include": "#string"
2491
+ }
2492
+ ]
2493
+ }
2494
+ ]
2495
+ },
2496
+ "parens": {
2497
+ "patterns": [
2498
+ {
2499
+ "begin": "\\(",
2500
+ "captures": {
2501
+ "0": {
2502
+ "name": "string.other.ruby"
2503
+ }
2504
+ },
2505
+ "end": "\\)",
2506
+ "patterns": [
2507
+ {
2508
+ "include": "#parens"
2509
+ },
2510
+ {
2511
+ "include": "#string"
2512
+ }
2513
+ ]
2514
+ }
2515
+ ]
2516
+ },
2517
+ "string": {
2518
+ "patterns": [
2519
+ {
2520
+ "begin": "(?=\\\\|#\\{)",
2521
+ "end": "(?!\\G)",
2522
+ "name": "string.other.ruby",
2523
+ "patterns": [
2524
+ {
2525
+ "include": "#escaped_char"
2526
+ },
2527
+ {
2528
+ "include": "#interpolated_ruby"
2529
+ }
2530
+ ]
2531
+ },
2532
+ {
2533
+ "match": "\\S\\w*",
2534
+ "name": "string.other.ruby"
2535
+ }
2536
+ ]
2537
+ }
2538
+ }
2539
+ },
2540
+ {
2541
+ "begin": "%x(?:([(\\[{<])|([^\\w\\s]|_))",
2542
+ "beginCaptures": {
2543
+ "0": {
2544
+ "name": "punctuation.definition.string.begin.ruby"
2545
+ }
2546
+ },
2547
+ "end": "[)\\]}>]\\2|\\1\\2",
2548
+ "endCaptures": {
2549
+ "0": {
2550
+ "name": "punctuation.definition.string.end.ruby"
2551
+ }
2552
+ },
2553
+ "name": "string.interpolated.percent.ruby",
2554
+ "patterns": [
2555
+ {
2556
+ "begin": "\\G(?<=\\()(?!\\))",
2557
+ "end": "(?=\\))",
2558
+ "patterns": [
2559
+ {
2560
+ "include": "#parens"
2561
+ }
2562
+ ]
2563
+ },
2564
+ {
2565
+ "begin": "\\G(?<=\\[)(?!\\])",
2566
+ "end": "(?=\\])",
2567
+ "patterns": [
2568
+ {
2569
+ "include": "#brackets"
2570
+ }
2571
+ ]
2572
+ },
2573
+ {
2574
+ "begin": "\\G(?<=\\{)(?!\\})",
2575
+ "end": "(?=\\})",
2576
+ "patterns": [
2577
+ {
2578
+ "include": "#braces"
2579
+ }
2580
+ ]
2581
+ },
2582
+ {
2583
+ "begin": "\\G(?<=<)(?!>)",
2584
+ "end": "(?=>)",
2585
+ "patterns": [
2586
+ {
2587
+ "include": "#angles"
2588
+ }
2589
+ ]
2590
+ },
2591
+ {
2592
+ "include": "#escaped_char"
2593
+ },
2594
+ {
2595
+ "include": "#interpolated_ruby"
2596
+ }
2597
+ ],
2598
+ "repository": {
2599
+ "angles": {
2600
+ "patterns": [
2601
+ {
2602
+ "include": "#escaped_char"
2603
+ },
2604
+ {
2605
+ "include": "#interpolated_ruby"
2606
+ },
2607
+ {
2608
+ "begin": "<",
2609
+ "end": ">",
2610
+ "patterns": [
2611
+ {
2612
+ "include": "#angles"
2613
+ }
2614
+ ]
2615
+ }
2616
+ ]
2617
+ },
2618
+ "braces": {
2619
+ "patterns": [
2620
+ {
2621
+ "include": "#escaped_char"
2622
+ },
2623
+ {
2624
+ "include": "#interpolated_ruby"
2625
+ },
2626
+ {
2627
+ "begin": "\\{",
2628
+ "end": "\\}",
2629
+ "patterns": [
2630
+ {
2631
+ "include": "#braces"
2632
+ }
2633
+ ]
2634
+ }
2635
+ ]
2636
+ },
2637
+ "brackets": {
2638
+ "patterns": [
2639
+ {
2640
+ "include": "#escaped_char"
2641
+ },
2642
+ {
2643
+ "include": "#interpolated_ruby"
2644
+ },
2645
+ {
2646
+ "begin": "\\[",
2647
+ "end": "\\]",
2648
+ "patterns": [
2649
+ {
2650
+ "include": "#brackets"
2651
+ }
2652
+ ]
2653
+ }
2654
+ ]
2655
+ },
2656
+ "parens": {
2657
+ "patterns": [
2658
+ {
2659
+ "include": "#escaped_char"
2660
+ },
2661
+ {
2662
+ "include": "#interpolated_ruby"
2663
+ },
2664
+ {
2665
+ "begin": "\\(",
2666
+ "end": "\\)",
2667
+ "patterns": [
2668
+ {
2669
+ "include": "#parens"
2670
+ }
2671
+ ]
2672
+ }
2673
+ ]
2674
+ }
2675
+ }
2676
+ }
2677
+ ]
2678
+ },
2679
+ "regex_sub": {
2680
+ "patterns": [
2681
+ {
2682
+ "include": "#interpolated_ruby"
2683
+ },
2684
+ {
2685
+ "include": "#escaped_char"
2686
+ },
2687
+ {
2688
+ "captures": {
2689
+ "1": {
2690
+ "name": "punctuation.definition.quantifier.begin.ruby"
2691
+ },
2692
+ "3": {
2693
+ "name": "punctuation.definition.quantifier.end.ruby"
2694
+ }
2695
+ },
2696
+ "match": "(\\{)\\d+(,\\d+)?(\\})",
2697
+ "name": "keyword.operator.quantifier.ruby"
2698
+ },
2699
+ {
2700
+ "begin": "\\[\\^?",
2701
+ "beginCaptures": {
2702
+ "0": {
2703
+ "name": "punctuation.definition.character-class.begin.ruby"
2704
+ }
2705
+ },
2706
+ "end": "\\]",
2707
+ "endCaptures": {
2708
+ "0": {
2709
+ "name": "punctuation.definition.character-class.end.ruby"
2710
+ }
2711
+ },
2712
+ "name": "constant.other.character-class.set.ruby",
2713
+ "patterns": [
2714
+ {
2715
+ "include": "#escaped_char"
2716
+ }
2717
+ ]
2718
+ },
2719
+ {
2720
+ "begin": "\\(\\?#",
2721
+ "beginCaptures": {
2722
+ "0": {
2723
+ "name": "punctuation.definition.comment.begin.ruby"
2724
+ }
2725
+ },
2726
+ "end": "\\)",
2727
+ "endCaptures": {
2728
+ "0": {
2729
+ "name": "punctuation.definition.comment.end.ruby"
2730
+ }
2731
+ },
2732
+ "name": "comment.line.number-sign.ruby",
2733
+ "patterns": [
2734
+ {
2735
+ "include": "#escaped_char"
2736
+ }
2737
+ ]
2738
+ },
2739
+ {
2740
+ "begin": "\\(",
2741
+ "captures": {
2742
+ "0": {
2743
+ "name": "punctuation.definition.group.ruby"
2744
+ }
2745
+ },
2746
+ "end": "\\)",
2747
+ "name": "meta.group.regexp.ruby",
2748
+ "patterns": [
2749
+ {
2750
+ "include": "#regex_sub"
2751
+ }
2752
+ ]
2753
+ },
2754
+ {
2755
+ "begin": "(?<=^|\\s)(#)\\s(?=[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$)",
2756
+ "beginCaptures": {
2757
+ "1": {
2758
+ "name": "punctuation.definition.comment.ruby"
2759
+ }
2760
+ },
2761
+ "comment": "We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.",
2762
+ "end": "$\\n?",
2763
+ "name": "comment.line.number-sign.ruby"
2764
+ }
2765
+ ]
2766
+ }
2767
+ },
2768
+ "scopeName": "source.ruby"
2769
+ }