github-linguist 5.2.0 → 5.3.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/grammars/annotation.liquidhaskell.haskell.json +1445 -0
  3. data/grammars/hint.haskell.json +134 -17
  4. data/grammars/hint.message.haskell.json +134 -17
  5. data/grammars/hint.type.haskell.json +134 -17
  6. data/grammars/source.abl.json +48 -48
  7. data/grammars/source.afm.json +8 -1
  8. data/grammars/source.angelscript.json +195 -0
  9. data/grammars/source.ats.json +128 -58
  10. data/grammars/source.awk.json +138 -138
  11. data/grammars/source.ballerina.json +434 -0
  12. data/grammars/source.chapel.json +1 -1
  13. data/grammars/source.clips.json +20 -20
  14. data/grammars/source.cobol.json +4 -3
  15. data/grammars/source.coffee.json +556 -109
  16. data/grammars/source.cs.json +10 -5
  17. data/grammars/source.csound-document.json +1 -1
  18. data/grammars/source.csound-score.json +9 -9
  19. data/grammars/source.csound.json +23 -28
  20. data/grammars/source.css.json +6 -5
  21. data/grammars/source.data-weave.json +1584 -0
  22. data/grammars/source.elixir.json +3 -61
  23. data/grammars/source.elm.json +88 -88
  24. data/grammars/source.emacs.lisp.json +12 -1
  25. data/grammars/source.haskell.json +134 -17
  26. data/grammars/source.hsig.json +1376 -0
  27. data/grammars/source.httpspec.json +128 -128
  28. data/grammars/source.jison.json +6 -14
  29. data/grammars/source.jisonlex.json +1 -9
  30. data/grammars/source.js.json +1 -0
  31. data/grammars/source.js.regexp.json +0 -4
  32. data/grammars/source.js.regexp.replacement.json +0 -4
  33. data/grammars/source.jsdoc.json +3 -3
  34. data/grammars/source.lsl.json +146 -53
  35. data/grammars/source.mercury.json +166 -166
  36. data/grammars/source.ne.json +108 -0
  37. data/grammars/source.nim_filter.json +51 -51
  38. data/grammars/source.nut.json +266 -0
  39. data/grammars/source.opal.json +112 -112
  40. data/grammars/source.opalsysdefs.json +16 -16
  41. data/grammars/source.pan.json +1 -1
  42. data/grammars/source.papyrus.skyrim.json +720 -720
  43. data/grammars/source.pawn.json +2 -2
  44. data/grammars/source.prolog.eclipse.json +42 -42
  45. data/grammars/source.prolog.json +41 -41
  46. data/grammars/source.purescript.json +41 -25
  47. data/grammars/source.python.json +47 -34
  48. data/grammars/source.racket.json +54 -54
  49. data/grammars/source.reason.json +37 -3
  50. data/grammars/source.regexp.python.json +31 -0
  51. data/grammars/source.ruby.gemfile.json +27 -0
  52. data/grammars/source.ruby.json +1057 -356
  53. data/grammars/source.rust.json +1 -1
  54. data/grammars/source.sbt.json +13 -3
  55. data/grammars/source.scala.json +74 -55
  56. data/grammars/source.shaderlab.json +1 -1
  57. data/grammars/source.shell.json +26 -21
  58. data/grammars/source.shen.json +91 -91
  59. data/grammars/source.sqf.json +1 -1
  60. data/grammars/source.supercollider.json +1 -1
  61. data/grammars/source.swift.json +4 -0
  62. data/grammars/source.terra.json +36 -37
  63. data/grammars/source.terraform.json +98 -98
  64. data/grammars/source.ts.json +2231 -1677
  65. data/grammars/source.tsx.json +142 -3520
  66. data/grammars/source.vbnet.json +201 -263
  67. data/grammars/source.viml.json +2 -2
  68. data/grammars/source.wdl.json +200 -0
  69. data/grammars/source.yaml.json +34 -16
  70. data/grammars/text.find-refs.json +3 -3
  71. data/grammars/text.haml.json +1 -1
  72. data/grammars/text.html.abl.json +6 -6
  73. data/grammars/text.html.erb.json +8 -11
  74. data/grammars/text.html.php.blade.json +256 -220
  75. data/grammars/text.html.vue.json +1 -1
  76. data/grammars/text.slim.json +31 -17
  77. data/grammars/text.tex.latex.haskell.json +150 -33
  78. data/lib/linguist/heuristics.rb +8 -0
  79. data/lib/linguist/languages.json +1 -1
  80. data/lib/linguist/languages.yml +82 -26
  81. data/lib/linguist/samples.json +134512 -132868
  82. data/lib/linguist/vendor.yml +3 -0
  83. data/lib/linguist/version.rb +1 -1
  84. metadata +13 -4
@@ -1,20 +1,24 @@
1
1
  {
2
+ "name": "Opal SysDefs",
3
+ "scopeName": "source.opalsysdefs",
2
4
  "fileTypes": [
3
5
  "SysDefs"
4
6
  ],
5
- "name": "Opal SysDefs",
7
+ "uuid": "3da0f3f0-8b32-41c9-857c-ce9be39b99d5",
6
8
  "patterns": [
7
9
  {
10
+ "name": "comment.line.number-sign.opalsysdefs",
11
+ "match": "(#).*$",
8
12
  "captures": {
9
13
  "1": {
10
14
  "name": "punctuation.definition.comment.opalsysdefs"
11
15
  }
12
- },
13
- "match": "(#).*$",
14
- "name": "comment.line.number-sign.opalsysdefs"
16
+ }
15
17
  },
16
18
  {
19
+ "name": "meta.keyvaluepair.opalsysdefs",
17
20
  "begin": "^\\s*([A-Z_]+)\\s*(\\+?=)",
21
+ "end": "\\n|(?=#)",
18
22
  "beginCaptures": {
19
23
  "1": {
20
24
  "name": "variable.parameter.opalsysdefs"
@@ -23,8 +27,6 @@
23
27
  "name": "punctuation.separator.keyvaluepair.opalsysdefs"
24
28
  }
25
29
  },
26
- "end": "\\n|(?=#)",
27
- "name": "meta.keyvaluepair.opalsysdefs",
28
30
  "patterns": [
29
31
  {
30
32
  "include": "#value"
@@ -32,15 +34,17 @@
32
34
  ]
33
35
  },
34
36
  {
35
- "match": ".*",
36
- "name": "invalid.illegal.justkidding.noseriously.whoknows.opalsysdefs"
37
+ "name": "invalid.illegal.justkidding.noseriously.whoknows.opalsysdefs",
38
+ "match": ".*"
37
39
  }
38
40
  ],
39
41
  "repository": {
40
42
  "value": {
41
43
  "patterns": [
42
44
  {
45
+ "name": "meta.structure.thingy.opalsysdefs",
43
46
  "begin": "(\\$)(\\()",
47
+ "end": "(\\))",
44
48
  "beginCaptures": {
45
49
  "1": {
46
50
  "name": "keyword.dollar.opalsysdefs"
@@ -49,22 +53,18 @@
49
53
  "name": "punctuation.definition.parameters.begin.opalsysdefs"
50
54
  }
51
55
  },
52
- "contentName": "string.other.opalsysdefs",
53
- "end": "(\\))",
54
56
  "endCaptures": {
55
57
  "1": {
56
58
  "name": "punctuation.definition.parameters.end.opalsysdefs"
57
59
  }
58
60
  },
59
- "name": "meta.structure.thingy.opalsysdefs"
61
+ "contentName": "string.other.opalsysdefs"
60
62
  },
61
63
  {
62
- "match": "([\\w\\?!\\_])*",
63
- "name": "string.other.opalsysdefs"
64
+ "name": "string.other.opalsysdefs",
65
+ "match": "([\\w\\?!\\_])*"
64
66
  }
65
67
  ]
66
68
  }
67
- },
68
- "scopeName": "source.opalsysdefs",
69
- "uuid": "3da0f3f0-8b32-41c9-857c-ce9be39b99d5"
69
+ }
70
70
  }
@@ -697,7 +697,7 @@
697
697
  "name": "punctuation.definition.comment.pan"
698
698
  }
699
699
  },
700
- "end": "(}$)",
700
+ "end": "(})",
701
701
  "endCaptures": {
702
702
  "1": {
703
703
  "name": "keyword.control.annotation-token.pan"
@@ -1,13 +1,15 @@
1
1
  {
2
+ "name": "Papyrus - Skyrim",
3
+ "scopeName": "source.papyrus.skyrim",
2
4
  "fileTypes": [
3
5
  "psc"
4
6
  ],
5
- "name": "Papyrus - Skyrim",
7
+ "uuid": "01a6e257-d5f5-46f0-8795-b04ebd6eeaa7",
6
8
  "patterns": [
7
9
  {
8
10
  "comment": "Empty line",
9
- "match": "^\\s*$",
10
- "name": "meta.emptyline.papyrus"
11
+ "name": "meta.emptyline.papyrus",
12
+ "match": "^\\s*$"
11
13
  },
12
14
  {
13
15
  "include": "#commentDocumentation"
@@ -86,79 +88,101 @@
86
88
  }
87
89
  ],
88
90
  "repository": {
89
- "addExpression": {
91
+ "endOfLine": {
90
92
  "patterns": [
91
93
  {
92
- "comment": "Addition or subtraction",
93
- "match": "(\\+|\\-)",
94
- "name": "keyword.operator.papyrus"
94
+ "include": "#commentBlock"
95
95
  },
96
96
  {
97
- "include": "#multExpression"
97
+ "include": "#commentLine"
98
+ },
99
+ {
100
+ "include": "#whitespace"
101
+ },
102
+ {
103
+ "include": "#multiline"
104
+ },
105
+ {
106
+ "include": "#unmatched"
98
107
  }
99
108
  ]
100
109
  },
101
- "andExpression": {
110
+ "comments": {
102
111
  "patterns": [
103
112
  {
104
- "comment": "AND",
105
- "match": "\\&\\&",
106
- "name": "keyword.operator.papyrus"
113
+ "include": "#commentBlock"
107
114
  },
108
115
  {
109
- "include": "#boolExpression"
116
+ "include": "#commentLine"
117
+ },
118
+ {
119
+ "include": "#commentDocumentation"
110
120
  }
111
121
  ]
112
122
  },
113
- "arrayAtom": {
123
+ "commentBlock": {
114
124
  "patterns": [
115
125
  {
116
- "begin": "\\[",
117
- "comment": "Array",
118
- "end": "\\]",
119
- "name": "meta.array.papyrus",
120
- "patterns": [
121
- {
122
- "include": "#expression"
123
- }
124
- ]
125
- },
126
- {
127
- "include": "#atom"
126
+ "comment": "Comment block",
127
+ "name": "comment.block.papyrus",
128
+ "begin": ";/",
129
+ "end": "/;"
128
130
  }
129
131
  ]
130
132
  },
131
- "arrayFuncOrId": {
133
+ "commentLine": {
132
134
  "patterns": [
133
135
  {
134
- "include": "#funcOrId"
135
- },
136
+ "comment": "Single line comment",
137
+ "name": "comment.line.papyrus",
138
+ "match": ";.*$"
139
+ }
140
+ ]
141
+ },
142
+ "commentDocumentation": {
143
+ "patterns": [
136
144
  {
137
- "begin": "\\[",
138
- "comment": "Array element access",
139
- "end": "\\]",
140
- "name": "meta.arrayelement.papyrus",
141
- "patterns": [
142
- {
143
- "include": "#expression"
144
- }
145
- ]
145
+ "comment": "Documentation comment",
146
+ "name": "comment.documentation.papyrus",
147
+ "begin": "^\\s*\\{",
148
+ "end": "\\}"
146
149
  }
147
150
  ]
148
151
  },
149
- "assign": {
152
+ "scriptHeader": {
150
153
  "patterns": [
151
154
  {
152
- "begin": "^\\s*",
153
- "comment": "Assign statement",
155
+ "comment": "Scriptheader",
156
+ "name": "meta.scriptheader.papyrus",
157
+ "begin": "(?i)^\\s*(scriptname)\\s+",
158
+ "beginCaptures": {
159
+ "1": {
160
+ "name": "keyword.other.papyrus"
161
+ }
162
+ },
154
163
  "end": "([\\n\\r])",
155
- "name": "meta.assign.papyrus",
156
164
  "patterns": [
157
165
  {
158
- "include": "#assignmentOperators"
166
+ "comment": "Script parent declaration",
167
+ "name": "keyword.other.papyrus",
168
+ "match": "(?i)\\b(extends)\\b"
159
169
  },
160
170
  {
161
- "include": "#expression"
171
+ "comment": "Script flags",
172
+ "name": "keyword.other.papyrus",
173
+ "match": "(?i)\\b(hidden|conditional)\\b"
174
+ },
175
+ {
176
+ "include": "#illegalKeywords"
177
+ },
178
+ {
179
+ "include": "#illegalSpecialVariables"
180
+ },
181
+ {
182
+ "include": "#illegalBaseTypes"
183
+ },
184
+ {
185
+ "include": "#typeIdentifier"
162
186
  },
163
187
  {
164
188
  "include": "#endOfLine"
@@ -167,208 +191,421 @@
167
191
  }
168
192
  ]
169
193
  },
170
- "assignmentOperators": {
194
+ "import": {
171
195
  "patterns": [
172
196
  {
173
- "comment": "Assignment operators",
174
- "match": "(\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=)",
175
- "name": "keyword.operator.papyrus"
197
+ "comment": "Import statement",
198
+ "name": "meta.import.papyrus",
199
+ "begin": "(?i)^\\s*(import)\\s+",
200
+ "beginCaptures": {
201
+ "1": {
202
+ "name": "keyword.other.papyrus"
203
+ }
204
+ },
205
+ "end": "([\\n\\r])",
206
+ "patterns": [
207
+ {
208
+ "include": "#illegalKeywords"
209
+ },
210
+ {
211
+ "include": "#illegalSpecialVariables"
212
+ },
213
+ {
214
+ "include": "#illegalBaseTypes"
215
+ },
216
+ {
217
+ "include": "#typeIdentifier"
218
+ },
219
+ {
220
+ "include": "#endOfLine"
221
+ }
222
+ ]
176
223
  }
177
224
  ]
178
225
  },
179
- "atom": {
226
+ "state": {
180
227
  "patterns": [
181
228
  {
182
- "begin": "(?i)\\b(new)\\s+([_a-z][0-9_a-z]*)\\[",
229
+ "comment": "State declaration",
230
+ "name": "meta.state.papyrus",
231
+ "begin": "(?i)^\\s*(?:(auto)\\s+)?(state)\\s+",
183
232
  "beginCaptures": {
184
233
  "1": {
185
- "name": "keyword.operator.papyrus"
234
+ "name": "keyword.other.papyrus"
186
235
  },
187
236
  "2": {
188
- "name": "storage.type.papyrus"
237
+ "name": "keyword.other.papyrus"
189
238
  }
190
239
  },
191
- "comment": "New array",
192
- "end": "\\]",
193
- "name": "meta.newarray.papyrus",
240
+ "end": "([\\n\\r])",
194
241
  "patterns": [
195
242
  {
196
- "include": "#integer"
197
- }
198
- ]
199
- },
200
- {
201
- "begin": "\\(",
202
- "comment": "Parenthesis",
203
- "end": "(\\)|[\\n\\r])",
204
- "name": "meta.parenthesis.papyrus",
205
- "patterns": [
243
+ "include": "#illegalKeywords"
244
+ },
206
245
  {
207
- "include": "#expression"
246
+ "include": "#illegalSpecialVariables"
247
+ },
248
+ {
249
+ "include": "#illegalBaseTypes"
250
+ },
251
+ {
252
+ "include": "#identifier"
253
+ },
254
+ {
255
+ "include": "#endOfLine"
208
256
  }
209
257
  ]
210
- },
211
- {
212
- "include": "#funcOrId"
213
258
  }
214
259
  ]
215
260
  },
216
- "baseTypes": {
261
+ "endState": {
217
262
  "patterns": [
218
263
  {
219
- "comment": "Type",
220
- "match": "(?i)\\b(bool|float|int|string)\\b",
221
- "name": "storage.type.papyrus"
264
+ "comment": "EndState statement",
265
+ "name": "meta.endstate.papyrus",
266
+ "begin": "(?i)^\\s*(endstate)\\b",
267
+ "beginCaptures": {
268
+ "1": {
269
+ "name": "keyword.other.papyrus"
270
+ }
271
+ },
272
+ "end": "([\\n\\r])",
273
+ "patterns": [
274
+ {
275
+ "include": "#endOfLine"
276
+ }
277
+ ]
222
278
  }
223
279
  ]
224
280
  },
225
- "bool": {
281
+ "property": {
226
282
  "patterns": [
227
283
  {
228
- "comment": "Boolean literal",
229
- "match": "(?i)\\b(true|false|none)\\b",
230
- "name": "constant.language.boolean.papyrus"
284
+ "comment": "Property declaration",
285
+ "name": "meta.property.papyrus",
286
+ "begin": "(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+(property)\\s+",
287
+ "beginCaptures": {
288
+ "1": {
289
+ "name": "storage.type.papyrus"
290
+ },
291
+ "2": {
292
+ "name": "keyword.other.papyrus"
293
+ }
294
+ },
295
+ "end": "([\\n\\r])",
296
+ "patterns": [
297
+ {
298
+ "comment": "Assignment operator",
299
+ "name": "keyword.operator.assignment.papyrus",
300
+ "match": "(\\=)"
301
+ },
302
+ {
303
+ "include": "#constants"
304
+ },
305
+ {
306
+ "include": "#propertyFlags"
307
+ },
308
+ {
309
+ "include": "#illegalKeywords"
310
+ },
311
+ {
312
+ "include": "#illegalSpecialVariables"
313
+ },
314
+ {
315
+ "include": "#illegalBaseTypes"
316
+ },
317
+ {
318
+ "include": "#identifier"
319
+ },
320
+ {
321
+ "include": "#endOfLine"
322
+ }
323
+ ]
231
324
  }
232
325
  ]
233
326
  },
234
- "boolExpression": {
327
+ "propertyFlags": {
235
328
  "patterns": [
236
329
  {
237
- "comment": "Comparison operators",
238
- "match": "(\\=\\=|\\!\\=|\\<\\=|\\>\\=|\\<|\\>)",
239
- "name": "keyword.operator.papyrus"
240
- },
241
- {
242
- "include": "#addExpression"
330
+ "comment": "Property flags",
331
+ "name": "keyword.other.papyrus",
332
+ "match": "(?i)\\b(auto|autoreadonly|conditional|hidden)\\b"
243
333
  }
244
334
  ]
245
335
  },
246
- "brackets": {
336
+ "endProperty": {
247
337
  "patterns": [
248
338
  {
249
- "comment": "Brackets",
250
- "match": "\\[\\]",
251
- "name": "meta.array.papyrus"
339
+ "comment": "EndProperty statement",
340
+ "name": "meta.endproperty.papyrus",
341
+ "begin": "(?i)^\\s*(endproperty)\\b",
342
+ "beginCaptures": {
343
+ "1": {
344
+ "name": "keyword.other.papyrus"
345
+ }
346
+ },
347
+ "end": "([\\n\\r])",
348
+ "patterns": [
349
+ {
350
+ "include": "#endOfLine"
351
+ }
352
+ ]
252
353
  }
253
354
  ]
254
355
  },
255
- "castAtom": {
356
+ "function": {
256
357
  "patterns": [
257
358
  {
258
- "captures": {
359
+ "comment": "Function declaration",
360
+ "name": "meta.function.papyrus",
361
+ "begin": "(?i)^\\s*(?:([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+)?(function)\\s+",
362
+ "beginCaptures": {
259
363
  "1": {
260
- "name": "keyword.operator.papyrus"
364
+ "name": "storage.type.papyrus"
261
365
  },
262
366
  "2": {
263
- "name": "storage.type.papyrus"
264
- }
265
- },
266
- "comment": "Cast",
267
- "match": "(?i)\\b(as)\\s+([_a-z][0-9_a-z]*)\\b",
268
- "name": "meta.cast.papyrus"
269
- },
270
- {
271
- "include": "#dotAtom"
367
+ "name": "keyword.control.functionstart.papyrus"
368
+ },
369
+ "3": {
370
+ "name": "entity.name.function.papyrus"
371
+ }
372
+ },
373
+ "end": "([\\n\\r])",
374
+ "patterns": [
375
+ {
376
+ "include": "#functionParameters"
377
+ },
378
+ {
379
+ "include": "#functionFlags"
380
+ },
381
+ {
382
+ "include": "#illegalKeywords"
383
+ },
384
+ {
385
+ "include": "#illegalSpecialVariables"
386
+ },
387
+ {
388
+ "include": "#illegalBaseTypes"
389
+ },
390
+ {
391
+ "include": "#functionIdentifier"
392
+ },
393
+ {
394
+ "include": "#endOfLine"
395
+ }
396
+ ]
272
397
  }
273
398
  ]
274
399
  },
275
- "comma": {
400
+ "functionParameters": {
276
401
  "patterns": [
277
402
  {
278
- "comment": "Comma",
279
- "match": "\\,",
280
- "name": "meta.comma.papyrus"
403
+ "comment": "Function parameters",
404
+ "name": "meta.functionparameters.papyrus",
405
+ "begin": "\\(",
406
+ "end": "\\)",
407
+ "patterns": [
408
+ {
409
+ "comment": "Assignment operator",
410
+ "name": "keyword.operator.assignment.papyrus",
411
+ "match": "(\\=)"
412
+ },
413
+ {
414
+ "include": "#constants"
415
+ },
416
+ {
417
+ "include": "#illegalKeywords"
418
+ },
419
+ {
420
+ "include": "#illegalSpecialVariables"
421
+ },
422
+ {
423
+ "include": "#functionParameter"
424
+ },
425
+ {
426
+ "include": "#comma"
427
+ },
428
+ {
429
+ "include": "#multiline"
430
+ },
431
+ {
432
+ "include": "#whitespace"
433
+ },
434
+ {
435
+ "include": "#unmatched"
436
+ }
437
+ ]
281
438
  }
282
439
  ]
283
440
  },
284
- "commentBlock": {
441
+ "functionParameter": {
285
442
  "patterns": [
286
443
  {
287
- "begin": ";/",
288
- "comment": "Comment block",
289
- "end": "/;",
290
- "name": "comment.block.papyrus"
444
+ "include": "#functionParameterIdentifier"
445
+ },
446
+ {
447
+ "include": "#typeIdentifier"
448
+ },
449
+ {
450
+ "include": "#brackets"
291
451
  }
292
452
  ]
293
453
  },
294
- "commentDocumentation": {
454
+ "functionParameterIdentifier": {
295
455
  "patterns": [
296
456
  {
297
- "begin": "^\\s*\\{",
298
- "comment": "Documentation comment",
299
- "end": "\\}",
300
- "name": "comment.documentation.papyrus"
457
+ "comment": "Event parameter identifier",
458
+ "name": "variable.parameter.papyrus",
459
+ "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)|\\=))"
301
460
  }
302
461
  ]
303
462
  },
304
- "commentLine": {
463
+ "functionFlags": {
305
464
  "patterns": [
306
465
  {
307
- "comment": "Single line comment",
308
- "match": ";.*$",
309
- "name": "comment.line.papyrus"
466
+ "comment": "Function flags",
467
+ "name": "keyword.other.papyrus",
468
+ "match": "(?i)\\b(native|global)\\b"
310
469
  }
311
470
  ]
312
471
  },
313
- "comments": {
472
+ "endFunction": {
314
473
  "patterns": [
315
474
  {
316
- "include": "#commentBlock"
317
- },
318
- {
319
- "include": "#commentLine"
320
- },
475
+ "comment": "EndFunction statement",
476
+ "name": "meta.endfunction.papyrus",
477
+ "begin": "(?i)^\\s*(endfunction)\\b",
478
+ "beginCaptures": {
479
+ "1": {
480
+ "name": "keyword.other.papyrus"
481
+ }
482
+ },
483
+ "end": "([\\n\\r])",
484
+ "patterns": [
485
+ {
486
+ "include": "#endOfLine"
487
+ }
488
+ ]
489
+ }
490
+ ]
491
+ },
492
+ "event": {
493
+ "patterns": [
321
494
  {
322
- "include": "#commentDocumentation"
495
+ "comment": "Event declaration",
496
+ "name": "meta.event.papyrus",
497
+ "begin": "(?i)^\\s*(event)\\s+",
498
+ "beginCaptures": {
499
+ "1": {
500
+ "name": "keyword.control.eventstart.papyrus"
501
+ },
502
+ "2": {
503
+ "name": "entity.name.function.papyrus"
504
+ }
505
+ },
506
+ "end": "([\\n\\r])",
507
+ "patterns": [
508
+ {
509
+ "include": "#eventParameters"
510
+ },
511
+ {
512
+ "include": "#eventFlags"
513
+ },
514
+ {
515
+ "include": "#illegalKeywords"
516
+ },
517
+ {
518
+ "include": "#illegalSpecialVariables"
519
+ },
520
+ {
521
+ "include": "#illegalBaseTypes"
522
+ },
523
+ {
524
+ "include": "#functionIdentifier"
525
+ },
526
+ {
527
+ "include": "#endOfLine"
528
+ }
529
+ ]
323
530
  }
324
531
  ]
325
532
  },
326
- "constants": {
533
+ "eventParameters": {
327
534
  "patterns": [
328
535
  {
329
- "include": "#bool"
330
- },
536
+ "comment": "Event parameters",
537
+ "name": "meta.eventparameters.papyrus",
538
+ "begin": "\\(",
539
+ "end": "\\)",
540
+ "patterns": [
541
+ {
542
+ "include": "#illegalKeywords"
543
+ },
544
+ {
545
+ "include": "#illegalSpecialVariables"
546
+ },
547
+ {
548
+ "include": "#eventParameter"
549
+ },
550
+ {
551
+ "include": "#comma"
552
+ },
553
+ {
554
+ "include": "#multiline"
555
+ },
556
+ {
557
+ "include": "#whitespace"
558
+ },
559
+ {
560
+ "include": "#unmatched"
561
+ }
562
+ ]
563
+ }
564
+ ]
565
+ },
566
+ "eventParameter": {
567
+ "patterns": [
331
568
  {
332
- "include": "#float"
569
+ "include": "#eventParameterIdentifier"
333
570
  },
334
571
  {
335
- "include": "#integer"
572
+ "include": "#typeIdentifier"
336
573
  },
337
574
  {
338
- "include": "#string"
575
+ "include": "#brackets"
339
576
  }
340
577
  ]
341
578
  },
342
- "dotAtom": {
579
+ "eventParameterIdentifier": {
343
580
  "patterns": [
344
581
  {
345
- "comment": "Dot",
346
- "match": "\\.",
347
- "name": "keyword.operator.papyrus"
348
- },
349
- {
350
- "include": "#constants"
351
- },
352
- {
353
- "include": "#arrayAtom"
354
- },
582
+ "comment": "Event parameter identifier",
583
+ "name": "variable.parameter.papyrus",
584
+ "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)))"
585
+ }
586
+ ]
587
+ },
588
+ "eventFlags": {
589
+ "patterns": [
355
590
  {
356
- "include": "#arrayFuncOrId"
591
+ "comment": "Event flags",
592
+ "name": "keyword.other.papyrus",
593
+ "match": "(?i)(?<=\\))\\s*(native)\\b"
357
594
  }
358
595
  ]
359
596
  },
360
- "else": {
597
+ "endEvent": {
361
598
  "patterns": [
362
599
  {
363
- "begin": "(?i)^\\s*(else)\\b",
600
+ "comment": "EndEvent statement",
601
+ "name": "meta.endevent.papyrus",
602
+ "begin": "(?i)^\\s*(endevent)\\b",
364
603
  "beginCaptures": {
365
604
  "1": {
366
605
  "name": "keyword.other.papyrus"
367
606
  }
368
607
  },
369
- "comment": "Else statement",
370
608
  "end": "([\\n\\r])",
371
- "name": "meta.else.papyrus",
372
609
  "patterns": [
373
610
  {
374
611
  "include": "#endOfLine"
@@ -377,18 +614,18 @@
377
614
  }
378
615
  ]
379
616
  },
380
- "elseif": {
617
+ "return": {
381
618
  "patterns": [
382
619
  {
383
- "begin": "(?i)^\\s*(elseif)\\b",
620
+ "comment": "Return statements",
621
+ "name": "meta.return.papyrus",
622
+ "begin": "(?i)^\\s*(return)\\b",
384
623
  "beginCaptures": {
385
624
  "1": {
386
625
  "name": "keyword.other.papyrus"
387
626
  }
388
627
  },
389
- "comment": "ElseIf statement",
390
628
  "end": "([\\n\\r])",
391
- "name": "meta.elseif.papyrus",
392
629
  "patterns": [
393
630
  {
394
631
  "include": "#expression"
@@ -400,19 +637,22 @@
400
637
  }
401
638
  ]
402
639
  },
403
- "endEvent": {
640
+ "if": {
404
641
  "patterns": [
405
642
  {
406
- "begin": "(?i)^\\s*(endevent)\\b",
643
+ "comment": "If statement",
644
+ "name": "meta.if.papyrus",
645
+ "begin": "(?i)^\\s*(if)\\b",
407
646
  "beginCaptures": {
408
647
  "1": {
409
648
  "name": "keyword.other.papyrus"
410
649
  }
411
650
  },
412
- "comment": "EndEvent statement",
413
651
  "end": "([\\n\\r])",
414
- "name": "meta.endevent.papyrus",
415
652
  "patterns": [
653
+ {
654
+ "include": "#expression"
655
+ },
416
656
  {
417
657
  "include": "#endOfLine"
418
658
  }
@@ -420,19 +660,22 @@
420
660
  }
421
661
  ]
422
662
  },
423
- "endFunction": {
663
+ "elseif": {
424
664
  "patterns": [
425
665
  {
426
- "begin": "(?i)^\\s*(endfunction)\\b",
666
+ "comment": "ElseIf statement",
667
+ "name": "meta.elseif.papyrus",
668
+ "begin": "(?i)^\\s*(elseif)\\b",
427
669
  "beginCaptures": {
428
670
  "1": {
429
671
  "name": "keyword.other.papyrus"
430
672
  }
431
673
  },
432
- "comment": "EndFunction statement",
433
674
  "end": "([\\n\\r])",
434
- "name": "meta.endfunction.papyrus",
435
675
  "patterns": [
676
+ {
677
+ "include": "#expression"
678
+ },
436
679
  {
437
680
  "include": "#endOfLine"
438
681
  }
@@ -440,18 +683,18 @@
440
683
  }
441
684
  ]
442
685
  },
443
- "endIf": {
686
+ "else": {
444
687
  "patterns": [
445
688
  {
446
- "begin": "(?i)^\\s*(endif)\\b",
447
- "beginCaptures": {
448
- "1": {
689
+ "comment": "Else statement",
690
+ "name": "meta.else.papyrus",
691
+ "begin": "(?i)^\\s*(else)\\b",
692
+ "beginCaptures": {
693
+ "1": {
449
694
  "name": "keyword.other.papyrus"
450
695
  }
451
696
  },
452
- "comment": "EndIf statement",
453
697
  "end": "([\\n\\r])",
454
- "name": "meta.endif.papyrus",
455
698
  "patterns": [
456
699
  {
457
700
  "include": "#endOfLine"
@@ -460,37 +703,18 @@
460
703
  }
461
704
  ]
462
705
  },
463
- "endOfLine": {
464
- "patterns": [
465
- {
466
- "include": "#commentBlock"
467
- },
468
- {
469
- "include": "#commentLine"
470
- },
471
- {
472
- "include": "#whitespace"
473
- },
474
- {
475
- "include": "#multiline"
476
- },
477
- {
478
- "include": "#unmatched"
479
- }
480
- ]
481
- },
482
- "endProperty": {
706
+ "endIf": {
483
707
  "patterns": [
484
708
  {
485
- "begin": "(?i)^\\s*(endproperty)\\b",
709
+ "comment": "EndIf statement",
710
+ "name": "meta.endif.papyrus",
711
+ "begin": "(?i)^\\s*(endif)\\b",
486
712
  "beginCaptures": {
487
713
  "1": {
488
714
  "name": "keyword.other.papyrus"
489
715
  }
490
716
  },
491
- "comment": "EndProperty statement",
492
717
  "end": "([\\n\\r])",
493
- "name": "meta.endproperty.papyrus",
494
718
  "patterns": [
495
719
  {
496
720
  "include": "#endOfLine"
@@ -499,19 +723,22 @@
499
723
  }
500
724
  ]
501
725
  },
502
- "endState": {
726
+ "while": {
503
727
  "patterns": [
504
728
  {
505
- "begin": "(?i)^\\s*(endstate)\\b",
729
+ "comment": "While statement",
730
+ "name": "meta.while.papyrus",
731
+ "begin": "(?i)^\\s*(while)\\b",
506
732
  "beginCaptures": {
507
733
  "1": {
508
734
  "name": "keyword.other.papyrus"
509
735
  }
510
736
  },
511
- "comment": "EndState statement",
512
737
  "end": "([\\n\\r])",
513
- "name": "meta.endstate.papyrus",
514
738
  "patterns": [
739
+ {
740
+ "include": "#expression"
741
+ },
515
742
  {
516
743
  "include": "#endOfLine"
517
744
  }
@@ -522,15 +749,15 @@
522
749
  "endWhile": {
523
750
  "patterns": [
524
751
  {
752
+ "comment": "EndWhile statement",
753
+ "name": "meta.endwhile.papyrus",
525
754
  "begin": "(?i)^\\s*(endwhile)\\b",
526
755
  "beginCaptures": {
527
756
  "1": {
528
757
  "name": "keyword.other.papyrus"
529
758
  }
530
759
  },
531
- "comment": "EndWhile statement",
532
760
  "end": "([\\n\\r])",
533
- "name": "meta.endwhile.papyrus",
534
761
  "patterns": [
535
762
  {
536
763
  "include": "#endOfLine"
@@ -539,40 +766,57 @@
539
766
  }
540
767
  ]
541
768
  },
542
- "event": {
769
+ "variable": {
543
770
  "patterns": [
544
771
  {
545
- "begin": "(?i)^\\s*(event)\\s+",
772
+ "comment": "Variable declaration with a default value",
773
+ "name": "meta.variable.papyrus",
774
+ "begin": "(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s*(\\=)\\s*)",
546
775
  "beginCaptures": {
547
776
  "1": {
548
- "name": "keyword.control.eventstart.papyrus"
777
+ "name": "storage.type.papyrus"
549
778
  },
550
779
  "2": {
551
- "name": "entity.name.function.papyrus"
780
+ "name": "variable.other.papyrus"
781
+ },
782
+ "3": {
783
+ "name": "keyword.operator.papyrus"
552
784
  }
553
785
  },
554
- "comment": "Event declaration",
555
786
  "end": "([\\n\\r])",
556
- "name": "meta.event.papyrus",
557
787
  "patterns": [
558
788
  {
559
- "include": "#eventParameters"
560
- },
561
- {
562
- "include": "#eventFlags"
789
+ "include": "#constants"
563
790
  },
564
791
  {
565
- "include": "#illegalKeywords"
792
+ "name": "keyword.other.papyrus",
793
+ "match": "(?i)(?:\\b(conditional)\\b)"
566
794
  },
567
795
  {
568
- "include": "#illegalSpecialVariables"
796
+ "include": "#expression"
569
797
  },
570
798
  {
571
- "include": "#illegalBaseTypes"
799
+ "include": "#endOfLine"
800
+ }
801
+ ]
802
+ },
803
+ {
804
+ "comment": "Scriptwide variable declaration without a default value",
805
+ "name": "meta.variable.papyrus",
806
+ "begin": "(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s+(conditional)\\b)?",
807
+ "beginCaptures": {
808
+ "1": {
809
+ "name": "storage.type.papyrus"
572
810
  },
573
- {
574
- "include": "#functionIdentifier"
811
+ "2": {
812
+ "name": "variable.other.papyrus"
575
813
  },
814
+ "3": {
815
+ "name": "keyword.other.papyrus"
816
+ }
817
+ },
818
+ "end": "([\\n\\r])",
819
+ "patterns": [
576
820
  {
577
821
  "include": "#endOfLine"
578
822
  }
@@ -580,94 +824,171 @@
580
824
  }
581
825
  ]
582
826
  },
583
- "eventFlags": {
827
+ "expression": {
584
828
  "patterns": [
585
829
  {
586
- "comment": "Event flags",
587
- "match": "(?i)(?<=\\))\\s*(native)\\b",
588
- "name": "keyword.other.papyrus"
830
+ "comment": "OR",
831
+ "name": "keyword.operator.papyrus",
832
+ "match": "\\|\\|"
833
+ },
834
+ {
835
+ "include": "#andExpression"
836
+ },
837
+ {
838
+ "include": "#endOfLine"
589
839
  }
590
840
  ]
591
841
  },
592
- "eventParameter": {
842
+ "andExpression": {
593
843
  "patterns": [
594
844
  {
595
- "include": "#eventParameterIdentifier"
845
+ "comment": "AND",
846
+ "name": "keyword.operator.papyrus",
847
+ "match": "\\&\\&"
596
848
  },
597
849
  {
598
- "include": "#typeIdentifier"
850
+ "include": "#boolExpression"
851
+ }
852
+ ]
853
+ },
854
+ "boolExpression": {
855
+ "patterns": [
856
+ {
857
+ "comment": "Comparison operators",
858
+ "name": "keyword.operator.papyrus",
859
+ "match": "(\\=\\=|\\!\\=|\\<\\=|\\>\\=|\\<|\\>)"
599
860
  },
600
861
  {
601
- "include": "#brackets"
862
+ "include": "#addExpression"
602
863
  }
603
864
  ]
604
865
  },
605
- "eventParameterIdentifier": {
866
+ "addExpression": {
606
867
  "patterns": [
607
868
  {
608
- "comment": "Event parameter identifier",
609
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)))",
610
- "name": "variable.parameter.papyrus"
869
+ "comment": "Addition or subtraction",
870
+ "name": "keyword.operator.papyrus",
871
+ "match": "(\\+|\\-)"
872
+ },
873
+ {
874
+ "include": "#multExpression"
611
875
  }
612
876
  ]
613
877
  },
614
- "eventParameters": {
878
+ "multExpression": {
615
879
  "patterns": [
616
880
  {
617
- "begin": "\\(",
618
- "comment": "Event parameters",
619
- "end": "\\)",
620
- "name": "meta.eventparameters.papyrus",
621
- "patterns": [
622
- {
623
- "include": "#illegalKeywords"
624
- },
625
- {
626
- "include": "#illegalSpecialVariables"
627
- },
628
- {
629
- "include": "#eventParameter"
630
- },
631
- {
632
- "include": "#comma"
633
- },
634
- {
635
- "include": "#multiline"
636
- },
637
- {
638
- "include": "#whitespace"
881
+ "comment": "Multiplication, division, or modulus",
882
+ "name": "keyword.operator.papyrus",
883
+ "match": "(\\*|/|\\%)"
884
+ },
885
+ {
886
+ "include": "#unaryExpression"
887
+ }
888
+ ]
889
+ },
890
+ "unaryExpression": {
891
+ "patterns": [
892
+ {
893
+ "comment": "Unary minus or NOT",
894
+ "name": "keyword.operator.papyrus",
895
+ "match": "(\\-|\\!)"
896
+ },
897
+ {
898
+ "include": "#castAtom"
899
+ }
900
+ ]
901
+ },
902
+ "castAtom": {
903
+ "patterns": [
904
+ {
905
+ "comment": "Cast",
906
+ "name": "meta.cast.papyrus",
907
+ "match": "(?i)\\b(as)\\s+([_a-z][0-9_a-z]*)\\b",
908
+ "captures": {
909
+ "1": {
910
+ "name": "keyword.operator.papyrus"
639
911
  },
640
- {
641
- "include": "#unmatched"
912
+ "2": {
913
+ "name": "storage.type.papyrus"
642
914
  }
643
- ]
915
+ }
916
+ },
917
+ {
918
+ "include": "#dotAtom"
644
919
  }
645
920
  ]
646
921
  },
647
- "expression": {
922
+ "dotAtom": {
648
923
  "patterns": [
649
924
  {
650
- "comment": "OR",
651
- "match": "\\|\\|",
652
- "name": "keyword.operator.papyrus"
925
+ "comment": "Dot",
926
+ "name": "keyword.operator.papyrus",
927
+ "match": "\\."
653
928
  },
654
929
  {
655
- "include": "#andExpression"
930
+ "include": "#constants"
656
931
  },
657
932
  {
658
- "include": "#endOfLine"
933
+ "include": "#arrayAtom"
934
+ },
935
+ {
936
+ "include": "#arrayFuncOrId"
659
937
  }
660
938
  ]
661
939
  },
662
- "float": {
940
+ "arrayAtom": {
663
941
  "patterns": [
664
942
  {
665
- "include": "#unaryMinus"
943
+ "comment": "Array",
944
+ "name": "meta.array.papyrus",
945
+ "begin": "\\[",
946
+ "end": "\\]",
947
+ "patterns": [
948
+ {
949
+ "include": "#expression"
950
+ }
951
+ ]
666
952
  },
667
953
  {
668
- "comment": "Float literal",
669
- "match": "\\b(\\d+\\.\\d+)\\b",
670
- "name": "constant.numeric.float.papyrus"
954
+ "include": "#atom"
955
+ }
956
+ ]
957
+ },
958
+ "atom": {
959
+ "patterns": [
960
+ {
961
+ "comment": "New array",
962
+ "name": "meta.newarray.papyrus",
963
+ "begin": "(?i)\\b(new)\\s+([_a-z][0-9_a-z]*)\\[",
964
+ "beginCaptures": {
965
+ "1": {
966
+ "name": "keyword.operator.papyrus"
967
+ },
968
+ "2": {
969
+ "name": "storage.type.papyrus"
970
+ }
971
+ },
972
+ "end": "\\]",
973
+ "patterns": [
974
+ {
975
+ "include": "#integer"
976
+ }
977
+ ]
978
+ },
979
+ {
980
+ "comment": "Parenthesis",
981
+ "name": "meta.parenthesis.papyrus",
982
+ "begin": "\\(",
983
+ "end": "(\\)|[\\n\\r])",
984
+ "patterns": [
985
+ {
986
+ "include": "#expression"
987
+ }
988
+ ]
989
+ },
990
+ {
991
+ "include": "#funcOrId"
671
992
  }
672
993
  ]
673
994
  },
@@ -675,8 +996,8 @@
675
996
  "patterns": [
676
997
  {
677
998
  "comment": "Length",
678
- "match": "(?i)\\b(length)\\b",
679
- "name": "keyword.other.papyrus"
999
+ "name": "keyword.other.papyrus",
1000
+ "match": "(?i)\\b(length)\\b"
680
1001
  },
681
1002
  {
682
1003
  "include": "#functionCall"
@@ -695,73 +1016,42 @@
695
1016
  }
696
1017
  ]
697
1018
  },
698
- "function": {
1019
+ "functionCall": {
699
1020
  "patterns": [
700
1021
  {
701
- "begin": "(?i)^\\s*(?:([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+)?(function)\\s+",
1022
+ "comment": "Function call",
1023
+ "name": "meta.functioncall.papyrus",
1024
+ "begin": "(?i)\\b([_a-z][0-9_a-z]*)\\(",
702
1025
  "beginCaptures": {
703
1026
  "1": {
704
- "name": "storage.type.papyrus"
705
- },
706
- "2": {
707
- "name": "keyword.control.functionstart.papyrus"
708
- },
709
- "3": {
710
- "name": "entity.name.function.papyrus"
1027
+ "name": "variable.other.papyrus"
711
1028
  }
712
1029
  },
713
- "comment": "Function declaration",
714
- "end": "([\\n\\r])",
715
- "name": "meta.function.papyrus",
1030
+ "end": "\\)",
716
1031
  "patterns": [
717
1032
  {
718
- "include": "#functionParameters"
719
- },
720
- {
721
- "include": "#functionFlags"
722
- },
723
- {
724
- "include": "#illegalKeywords"
725
- },
726
- {
727
- "include": "#illegalSpecialVariables"
728
- },
729
- {
730
- "include": "#illegalBaseTypes"
731
- },
732
- {
733
- "include": "#functionIdentifier"
734
- },
735
- {
736
- "include": "#endOfLine"
1033
+ "include": "#functionCallParameters"
737
1034
  }
738
1035
  ]
739
1036
  }
740
1037
  ]
741
1038
  },
742
- "functionCall": {
1039
+ "functionCallParameters": {
743
1040
  "patterns": [
744
1041
  {
745
- "begin": "(?i)\\b([_a-z][0-9_a-z]*)\\(",
746
- "beginCaptures": {
747
- "1": {
748
- "name": "variable.other.papyrus"
749
- }
750
- },
751
- "comment": "Function call",
752
- "end": "\\)",
753
- "name": "meta.functioncall.papyrus",
754
- "patterns": [
755
- {
756
- "include": "#functionCallParameters"
757
- }
758
- ]
1042
+ "include": "#comma"
1043
+ },
1044
+ {
1045
+ "include": "#functionCallParameter"
759
1046
  }
760
1047
  ]
761
1048
  },
762
1049
  "functionCallParameter": {
763
1050
  "patterns": [
764
1051
  {
1052
+ "comment": "Specific parameter",
1053
+ "name": "meta.functioncallparameter.papyrus",
1054
+ "match": "(?i)\\b(?:([_a-z][0-9_a-z]*)\\s*(\\=)(?!\\=))?",
765
1055
  "captures": {
766
1056
  "1": {
767
1057
  "name": "variable.parameter.papyrus"
@@ -769,129 +1059,42 @@
769
1059
  "2": {
770
1060
  "name": "keyword.operator.papyrus"
771
1061
  }
772
- },
773
- "comment": "Specific parameter",
774
- "match": "(?i)\\b(?:([_a-z][0-9_a-z]*)\\s*(\\=)(?!\\=))?",
775
- "name": "meta.functioncallparameter.papyrus"
1062
+ }
776
1063
  },
777
1064
  {
778
1065
  "include": "#expression"
779
1066
  }
780
1067
  ]
781
1068
  },
782
- "functionCallParameters": {
783
- "patterns": [
784
- {
785
- "include": "#comma"
786
- },
787
- {
788
- "include": "#functionCallParameter"
789
- }
790
- ]
791
- },
792
- "functionFlags": {
793
- "patterns": [
794
- {
795
- "comment": "Function flags",
796
- "match": "(?i)\\b(native|global)\\b",
797
- "name": "keyword.other.papyrus"
798
- }
799
- ]
800
- },
801
- "functionIdentifier": {
802
- "patterns": [
803
- {
804
- "comment": "Function/event identifier",
805
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=\\()",
806
- "name": "entity.name.function.papyrus"
807
- }
808
- ]
809
- },
810
- "functionParameter": {
1069
+ "arrayFuncOrId": {
811
1070
  "patterns": [
812
1071
  {
813
- "include": "#functionParameterIdentifier"
814
- },
815
- {
816
- "include": "#typeIdentifier"
1072
+ "include": "#funcOrId"
817
1073
  },
818
1074
  {
819
- "include": "#brackets"
820
- }
821
- ]
822
- },
823
- "functionParameterIdentifier": {
824
- "patterns": [
825
- {
826
- "comment": "Event parameter identifier",
827
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)|\\=))",
828
- "name": "variable.parameter.papyrus"
829
- }
830
- ]
831
- },
832
- "functionParameters": {
833
- "patterns": [
834
- {
835
- "begin": "\\(",
836
- "comment": "Function parameters",
837
- "end": "\\)",
838
- "name": "meta.functionparameters.papyrus",
1075
+ "comment": "Array element access",
1076
+ "name": "meta.arrayelement.papyrus",
1077
+ "begin": "\\[",
1078
+ "end": "\\]",
839
1079
  "patterns": [
840
1080
  {
841
- "comment": "Assignment operator",
842
- "match": "(\\=)",
843
- "name": "keyword.operator.assignment.papyrus"
844
- },
845
- {
846
- "include": "#constants"
847
- },
848
- {
849
- "include": "#illegalKeywords"
850
- },
851
- {
852
- "include": "#illegalSpecialVariables"
853
- },
854
- {
855
- "include": "#functionParameter"
856
- },
857
- {
858
- "include": "#comma"
859
- },
860
- {
861
- "include": "#multiline"
862
- },
863
- {
864
- "include": "#whitespace"
865
- },
866
- {
867
- "include": "#unmatched"
1081
+ "include": "#expression"
868
1082
  }
869
1083
  ]
870
1084
  }
871
1085
  ]
872
1086
  },
873
- "identifier": {
874
- "patterns": [
875
- {
876
- "comment": "Identifier",
877
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b",
878
- "name": "variable.other.papyrus"
879
- }
880
- ]
881
- },
882
- "if": {
1087
+ "assign": {
883
1088
  "patterns": [
884
1089
  {
885
- "begin": "(?i)^\\s*(if)\\b",
886
- "beginCaptures": {
887
- "1": {
888
- "name": "keyword.other.papyrus"
889
- }
890
- },
891
- "comment": "If statement",
1090
+ "comment": "Assign statement",
1091
+ "name": "meta.assign.papyrus",
1092
+ "begin": "^\\s*",
892
1093
  "end": "([\\n\\r])",
893
- "name": "meta.if.papyrus",
894
1094
  "patterns": [
1095
+ {
1096
+ "include": "#assignmentOperators"
1097
+ },
895
1098
  {
896
1099
  "include": "#expression"
897
1100
  },
@@ -902,447 +1105,244 @@
902
1105
  }
903
1106
  ]
904
1107
  },
905
- "illegalBaseTypes": {
1108
+ "assignmentOperators": {
906
1109
  "patterns": [
907
1110
  {
908
- "comment": "Type",
909
- "match": "(?i)\\b(bool|float|int|string)\\b",
910
- "name": "meta.invalid.papyrus"
1111
+ "comment": "Assignment operators",
1112
+ "name": "keyword.operator.papyrus",
1113
+ "match": "(\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=)"
911
1114
  }
912
1115
  ]
913
1116
  },
914
- "illegalKeywords": {
1117
+ "comma": {
915
1118
  "patterns": [
916
1119
  {
917
- "comment": "Keywords",
918
- "match": "(?i)\\b(as|auto|autoreadonly|else|elseif|endevent|endfunction|endif|endproperty|endstate|endwhile|event|extends|false|function|global|if|import|length|native|new|none|property|return|scriptname|state|true|while)\\b",
919
- "name": "meta.invalid.papyrus"
1120
+ "comment": "Comma",
1121
+ "name": "meta.comma.papyrus",
1122
+ "match": "\\,"
920
1123
  }
921
1124
  ]
922
1125
  },
923
- "illegalSpecialVariables": {
1126
+ "whitespace": {
924
1127
  "patterns": [
925
1128
  {
926
- "comment": "Special variables",
927
- "match": "(?i)\\b(parent|self)\\b",
928
- "name": "meta.invalid.papyrus"
1129
+ "comment": "Whitespace",
1130
+ "name": "meta.whitespace.papyrus",
1131
+ "match": "([ \\t])"
929
1132
  }
930
1133
  ]
931
1134
  },
932
- "import": {
1135
+ "multiline": {
933
1136
  "patterns": [
934
1137
  {
935
- "begin": "(?i)^\\s*(import)\\s+",
1138
+ "comment": "Multiline",
1139
+ "name": "meta.multiline.papyrus",
1140
+ "begin": "\\\\",
936
1141
  "beginCaptures": {
937
- "1": {
938
- "name": "keyword.other.papyrus"
1142
+ "0": {
1143
+ "name": "keyword.operator.papyrus"
939
1144
  }
940
1145
  },
941
- "comment": "Import statement",
942
1146
  "end": "([\\n\\r])",
943
- "name": "meta.import.papyrus",
944
1147
  "patterns": [
945
1148
  {
946
- "include": "#illegalKeywords"
947
- },
948
- {
949
- "include": "#illegalSpecialVariables"
1149
+ "include": "#commentBlock"
950
1150
  },
951
1151
  {
952
- "include": "#illegalBaseTypes"
1152
+ "include": "#commentLine"
953
1153
  },
954
1154
  {
955
- "include": "#typeIdentifier"
1155
+ "include": "#whitespace"
956
1156
  },
957
1157
  {
958
- "include": "#endOfLine"
1158
+ "include": "#unmatched"
959
1159
  }
960
1160
  ]
961
1161
  }
962
1162
  ]
963
1163
  },
964
- "integer": {
1164
+ "unmatched": {
965
1165
  "patterns": [
966
1166
  {
967
- "include": "#unaryMinus"
968
- },
969
- {
970
- "comment": "Integer literal",
971
- "match": "(?i)\\b(0x[0-9a-f]+|\\d+)\\b",
972
- "name": "constant.numeric.integer.papyrus"
1167
+ "comment": "Unmatched",
1168
+ "name": "meta.invalid.papyrus",
1169
+ "match": "([^\\n\\r])"
973
1170
  }
974
1171
  ]
975
1172
  },
976
- "keywords": {
1173
+ "unaryMinus": {
977
1174
  "patterns": [
978
1175
  {
979
- "comment": "Keywords",
980
- "match": "(?i)\\b(as|auto|autoreadonly|else|elseif|endevent|endfunction|endif|endproperty|endstate|endwhile|event|extends|false|function|global|if|import|length|native|new|none|property|return|scriptname|state|true|while)\\b",
981
- "name": "keyword.other.papyrus"
1176
+ "comment": "Unary minus",
1177
+ "name": "keyword.operator.papyrus",
1178
+ "match": "\\-(?=\\d)"
982
1179
  }
983
1180
  ]
984
1181
  },
985
- "multExpression": {
1182
+ "constants": {
986
1183
  "patterns": [
987
1184
  {
988
- "comment": "Multiplication, division, or modulus",
989
- "match": "(\\*|/|\\%)",
990
- "name": "keyword.operator.papyrus"
1185
+ "include": "#bool"
991
1186
  },
992
1187
  {
993
- "include": "#unaryExpression"
994
- }
995
- ]
996
- },
997
- "multiline": {
998
- "patterns": [
1188
+ "include": "#float"
1189
+ },
999
1190
  {
1000
- "begin": "\\\\",
1001
- "beginCaptures": {
1002
- "0": {
1003
- "name": "keyword.operator.papyrus"
1004
- }
1005
- },
1006
- "comment": "Multiline",
1007
- "end": "([\\n\\r])",
1008
- "name": "meta.multiline.papyrus",
1009
- "patterns": [
1010
- {
1011
- "include": "#commentBlock"
1012
- },
1013
- {
1014
- "include": "#commentLine"
1015
- },
1016
- {
1017
- "include": "#whitespace"
1018
- },
1019
- {
1020
- "include": "#unmatched"
1021
- }
1022
- ]
1191
+ "include": "#integer"
1192
+ },
1193
+ {
1194
+ "include": "#string"
1023
1195
  }
1024
1196
  ]
1025
1197
  },
1026
- "parameterIdentifier": {
1198
+ "bool": {
1027
1199
  "patterns": [
1028
1200
  {
1029
- "comment": "Parameter identifier",
1030
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b",
1031
- "name": "variable.parameter.papyrus"
1201
+ "comment": "Boolean literal",
1202
+ "name": "constant.language.boolean.papyrus",
1203
+ "match": "(?i)\\b(true|false|none)\\b"
1032
1204
  }
1033
1205
  ]
1034
1206
  },
1035
- "property": {
1207
+ "float": {
1036
1208
  "patterns": [
1037
1209
  {
1038
- "begin": "(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+(property)\\s+",
1039
- "beginCaptures": {
1040
- "1": {
1041
- "name": "storage.type.papyrus"
1042
- },
1043
- "2": {
1044
- "name": "keyword.other.papyrus"
1045
- }
1046
- },
1047
- "comment": "Property declaration",
1048
- "end": "([\\n\\r])",
1049
- "name": "meta.property.papyrus",
1050
- "patterns": [
1051
- {
1052
- "comment": "Assignment operator",
1053
- "match": "(\\=)",
1054
- "name": "keyword.operator.assignment.papyrus"
1055
- },
1056
- {
1057
- "include": "#constants"
1058
- },
1059
- {
1060
- "include": "#propertyFlags"
1061
- },
1062
- {
1063
- "include": "#illegalKeywords"
1064
- },
1065
- {
1066
- "include": "#illegalSpecialVariables"
1067
- },
1068
- {
1069
- "include": "#illegalBaseTypes"
1070
- },
1071
- {
1072
- "include": "#identifier"
1073
- },
1074
- {
1075
- "include": "#endOfLine"
1076
- }
1077
- ]
1210
+ "include": "#unaryMinus"
1211
+ },
1212
+ {
1213
+ "comment": "Float literal",
1214
+ "name": "constant.numeric.float.papyrus",
1215
+ "match": "\\b(\\d+\\.\\d+)\\b"
1078
1216
  }
1079
1217
  ]
1080
1218
  },
1081
- "propertyFlags": {
1219
+ "integer": {
1082
1220
  "patterns": [
1083
1221
  {
1084
- "comment": "Property flags",
1085
- "match": "(?i)\\b(auto|autoreadonly|conditional|hidden)\\b",
1086
- "name": "keyword.other.papyrus"
1222
+ "include": "#unaryMinus"
1223
+ },
1224
+ {
1225
+ "comment": "Integer literal",
1226
+ "name": "constant.numeric.integer.papyrus",
1227
+ "match": "(?i)\\b(0x[0-9a-f]+|\\d+)\\b"
1087
1228
  }
1088
1229
  ]
1089
1230
  },
1090
- "return": {
1231
+ "string": {
1091
1232
  "patterns": [
1092
1233
  {
1093
- "begin": "(?i)^\\s*(return)\\b",
1094
- "beginCaptures": {
1095
- "1": {
1096
- "name": "keyword.other.papyrus"
1097
- }
1098
- },
1099
- "comment": "Return statements",
1100
- "end": "([\\n\\r])",
1101
- "name": "meta.return.papyrus",
1234
+ "comment": "String literal",
1235
+ "name": "string.quoted.double",
1236
+ "begin": "\\\"",
1237
+ "end": "\\\"",
1102
1238
  "patterns": [
1103
1239
  {
1104
- "include": "#expression"
1105
- },
1106
- {
1107
- "include": "#endOfLine"
1240
+ "comment": "Escape sequences",
1241
+ "name": "constant.character.escape.papyrus",
1242
+ "match": "(\\\\.)"
1108
1243
  }
1109
1244
  ]
1110
1245
  }
1111
1246
  ]
1112
1247
  },
1113
- "scriptHeader": {
1248
+ "keywords": {
1114
1249
  "patterns": [
1115
1250
  {
1116
- "begin": "(?i)^\\s*(scriptname)\\s+",
1117
- "beginCaptures": {
1118
- "1": {
1119
- "name": "keyword.other.papyrus"
1120
- }
1121
- },
1122
- "comment": "Scriptheader",
1123
- "end": "([\\n\\r])",
1124
- "name": "meta.scriptheader.papyrus",
1125
- "patterns": [
1126
- {
1127
- "comment": "Script parent declaration",
1128
- "match": "(?i)\\b(extends)\\b",
1129
- "name": "keyword.other.papyrus"
1130
- },
1131
- {
1132
- "comment": "Script flags",
1133
- "match": "(?i)\\b(hidden|conditional)\\b",
1134
- "name": "keyword.other.papyrus"
1135
- },
1136
- {
1137
- "include": "#illegalKeywords"
1138
- },
1139
- {
1140
- "include": "#illegalSpecialVariables"
1141
- },
1142
- {
1143
- "include": "#illegalBaseTypes"
1144
- },
1145
- {
1146
- "include": "#typeIdentifier"
1147
- },
1148
- {
1149
- "include": "#endOfLine"
1150
- }
1151
- ]
1251
+ "comment": "Keywords",
1252
+ "name": "keyword.other.papyrus",
1253
+ "match": "(?i)\\b(as|auto|autoreadonly|else|elseif|endevent|endfunction|endif|endproperty|endstate|endwhile|event|extends|false|function|global|if|import|length|native|new|none|property|return|scriptname|state|true|while)\\b"
1152
1254
  }
1153
1255
  ]
1154
1256
  },
1155
- "specialVariables": {
1257
+ "illegalKeywords": {
1156
1258
  "patterns": [
1157
1259
  {
1158
- "comment": "Special variables",
1159
- "match": "(?i)\\b(parent|self)\\b",
1160
- "name": "keyword.other.papyrus"
1260
+ "comment": "Keywords",
1261
+ "name": "meta.invalid.papyrus",
1262
+ "match": "(?i)\\b(as|auto|autoreadonly|else|elseif|endevent|endfunction|endif|endproperty|endstate|endwhile|event|extends|false|function|global|if|import|length|native|new|none|property|return|scriptname|state|true|while)\\b"
1161
1263
  }
1162
1264
  ]
1163
1265
  },
1164
- "state": {
1266
+ "specialVariables": {
1165
1267
  "patterns": [
1166
1268
  {
1167
- "begin": "(?i)^\\s*(?:(auto)\\s+)?(state)\\s+",
1168
- "beginCaptures": {
1169
- "1": {
1170
- "name": "keyword.other.papyrus"
1171
- },
1172
- "2": {
1173
- "name": "keyword.other.papyrus"
1174
- }
1175
- },
1176
- "comment": "State declaration",
1177
- "end": "([\\n\\r])",
1178
- "name": "meta.state.papyrus",
1179
- "patterns": [
1180
- {
1181
- "include": "#illegalKeywords"
1182
- },
1183
- {
1184
- "include": "#illegalSpecialVariables"
1185
- },
1186
- {
1187
- "include": "#illegalBaseTypes"
1188
- },
1189
- {
1190
- "include": "#identifier"
1191
- },
1192
- {
1193
- "include": "#endOfLine"
1194
- }
1195
- ]
1269
+ "comment": "Special variables",
1270
+ "name": "keyword.other.papyrus",
1271
+ "match": "(?i)\\b(parent|self)\\b"
1196
1272
  }
1197
1273
  ]
1198
1274
  },
1199
- "string": {
1275
+ "illegalSpecialVariables": {
1200
1276
  "patterns": [
1201
1277
  {
1202
- "begin": "\\\"",
1203
- "comment": "String literal",
1204
- "end": "\\\"",
1205
- "name": "string.quoted.double",
1206
- "patterns": [
1207
- {
1208
- "comment": "Escape sequences",
1209
- "match": "(\\\\.)",
1210
- "name": "constant.character.escape.papyrus"
1211
- }
1212
- ]
1278
+ "comment": "Special variables",
1279
+ "name": "meta.invalid.papyrus",
1280
+ "match": "(?i)\\b(parent|self)\\b"
1213
1281
  }
1214
1282
  ]
1215
1283
  },
1216
- "typeIdentifier": {
1284
+ "baseTypes": {
1217
1285
  "patterns": [
1218
1286
  {
1219
- "comment": "Type identifier",
1220
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b",
1221
- "name": "storage.type.papyrus"
1287
+ "comment": "Type",
1288
+ "name": "storage.type.papyrus",
1289
+ "match": "(?i)\\b(bool|float|int|string)\\b"
1222
1290
  }
1223
1291
  ]
1224
1292
  },
1225
- "unaryExpression": {
1293
+ "illegalBaseTypes": {
1226
1294
  "patterns": [
1227
1295
  {
1228
- "comment": "Unary minus or NOT",
1229
- "match": "(\\-|\\!)",
1230
- "name": "keyword.operator.papyrus"
1231
- },
1232
- {
1233
- "include": "#castAtom"
1296
+ "comment": "Type",
1297
+ "name": "meta.invalid.papyrus",
1298
+ "match": "(?i)\\b(bool|float|int|string)\\b"
1234
1299
  }
1235
1300
  ]
1236
1301
  },
1237
- "unaryMinus": {
1302
+ "identifier": {
1238
1303
  "patterns": [
1239
1304
  {
1240
- "comment": "Unary minus",
1241
- "match": "\\-(?=\\d)",
1242
- "name": "keyword.operator.papyrus"
1305
+ "comment": "Identifier",
1306
+ "name": "variable.other.papyrus",
1307
+ "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b"
1243
1308
  }
1244
1309
  ]
1245
1310
  },
1246
- "unmatched": {
1311
+ "functionIdentifier": {
1247
1312
  "patterns": [
1248
1313
  {
1249
- "comment": "Unmatched",
1250
- "match": "([^\\n\\r])",
1251
- "name": "meta.invalid.papyrus"
1314
+ "comment": "Function/event identifier",
1315
+ "name": "entity.name.function.papyrus",
1316
+ "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=\\()"
1252
1317
  }
1253
1318
  ]
1254
1319
  },
1255
- "variable": {
1320
+ "typeIdentifier": {
1256
1321
  "patterns": [
1257
1322
  {
1258
- "begin": "(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s*(\\=)\\s*)",
1259
- "beginCaptures": {
1260
- "1": {
1261
- "name": "storage.type.papyrus"
1262
- },
1263
- "2": {
1264
- "name": "variable.other.papyrus"
1265
- },
1266
- "3": {
1267
- "name": "keyword.operator.papyrus"
1268
- }
1269
- },
1270
- "comment": "Variable declaration with a default value",
1271
- "end": "([\\n\\r])",
1272
- "name": "meta.variable.papyrus",
1273
- "patterns": [
1274
- {
1275
- "include": "#constants"
1276
- },
1277
- {
1278
- "match": "(?i)(?:\\b(conditional)\\b)",
1279
- "name": "keyword.other.papyrus"
1280
- },
1281
- {
1282
- "include": "#expression"
1283
- },
1284
- {
1285
- "include": "#endOfLine"
1286
- }
1287
- ]
1288
- },
1289
- {
1290
- "begin": "(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s+(conditional)\\b)?",
1291
- "beginCaptures": {
1292
- "1": {
1293
- "name": "storage.type.papyrus"
1294
- },
1295
- "2": {
1296
- "name": "variable.other.papyrus"
1297
- },
1298
- "3": {
1299
- "name": "keyword.other.papyrus"
1300
- }
1301
- },
1302
- "comment": "Scriptwide variable declaration without a default value",
1303
- "end": "([\\n\\r])",
1304
- "name": "meta.variable.papyrus",
1305
- "patterns": [
1306
- {
1307
- "include": "#endOfLine"
1308
- }
1309
- ]
1323
+ "comment": "Type identifier",
1324
+ "name": "storage.type.papyrus",
1325
+ "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b"
1310
1326
  }
1311
1327
  ]
1312
1328
  },
1313
- "while": {
1329
+ "parameterIdentifier": {
1314
1330
  "patterns": [
1315
1331
  {
1316
- "begin": "(?i)^\\s*(while)\\b",
1317
- "beginCaptures": {
1318
- "1": {
1319
- "name": "keyword.other.papyrus"
1320
- }
1321
- },
1322
- "comment": "While statement",
1323
- "end": "([\\n\\r])",
1324
- "name": "meta.while.papyrus",
1325
- "patterns": [
1326
- {
1327
- "include": "#expression"
1328
- },
1329
- {
1330
- "include": "#endOfLine"
1331
- }
1332
- ]
1332
+ "comment": "Parameter identifier",
1333
+ "name": "variable.parameter.papyrus",
1334
+ "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b"
1333
1335
  }
1334
1336
  ]
1335
1337
  },
1336
- "whitespace": {
1338
+ "brackets": {
1337
1339
  "patterns": [
1338
1340
  {
1339
- "comment": "Whitespace",
1340
- "match": "([ \\t])",
1341
- "name": "meta.whitespace.papyrus"
1341
+ "comment": "Brackets",
1342
+ "name": "meta.array.papyrus",
1343
+ "match": "\\[\\]"
1342
1344
  }
1343
1345
  ]
1344
1346
  }
1345
- },
1346
- "scopeName": "source.papyrus.skyrim",
1347
- "uuid": "01a6e257-d5f5-46f0-8795-b04ebd6eeaa7"
1347
+ }
1348
1348
  }