github-linguist 4.8.4 → 4.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,10 @@ module Linguist
15
15
 
16
16
  MODELINES = [EMACS_MODELINE, VIM_MODELINE_1, VIM_MODELINE_2]
17
17
 
18
+ # Scope of the search for modelines
19
+ # Number of lines to check at the beginning and at the end of the file
20
+ SEARCH_SCOPE = 5
21
+
18
22
  # Public: Detects language based on Vim and Emacs modelines
19
23
  #
20
24
  # blob - An object that quacks like a blob.
@@ -26,7 +30,9 @@ module Linguist
26
30
  # Returns an Array with one Language if the blob has a Vim or Emacs modeline
27
31
  # that matches a Language name or alias. Returns an empty array if no match.
28
32
  def self.call(blob, _ = nil)
29
- Array(Language.find_by_alias(modeline(blob.data)))
33
+ header = blob.lines.first(SEARCH_SCOPE).join("\n")
34
+ footer = blob.lines.last(SEARCH_SCOPE).join("\n")
35
+ Array(Language.find_by_alias(modeline(header + footer)))
30
36
  end
31
37
 
32
38
  # Public: Get the modeline from the first n-lines of the file
@@ -190,6 +190,7 @@
190
190
 
191
191
  # django
192
192
  - (^|/)admin_media/
193
+ - (^|/)env/
193
194
 
194
195
  # Fabric
195
196
  - ^fabfile\.py$
@@ -1,3 +1,3 @@
1
1
  module Linguist
2
- VERSION = "4.8.4"
2
+ VERSION = "4.8.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-linguist
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.4
4
+ version: 4.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: charlock_holmes
@@ -244,6 +244,7 @@ files:
244
244
  - grammars/source.cirru.json
245
245
  - grammars/source.clarion.json
246
246
  - grammars/source.click.json
247
+ - grammars/source.clips.json
247
248
  - grammars/source.clojure.json
248
249
  - grammars/source.cm.json
249
250
  - grammars/source.cmake.json
@@ -386,7 +387,6 @@ files:
386
387
  - grammars/source.opencobol.json
387
388
  - grammars/source.ox.json
388
389
  - grammars/source.oz.json
389
- - grammars/source.papyrus.fallout4.json
390
390
  - grammars/source.papyrus.skyrim.json
391
391
  - grammars/source.parrot.pir.json
392
392
  - grammars/source.pascal.json
@@ -457,6 +457,8 @@ files:
457
457
  - grammars/source.tea.json
458
458
  - grammars/source.terra.json
459
459
  - grammars/source.thrift.json
460
+ - grammars/source.tla.json
461
+ - grammars/source.toc.json
460
462
  - grammars/source.toml.json
461
463
  - grammars/source.ts.json
462
464
  - grammars/source.tsx.json
@@ -501,6 +503,7 @@ files:
501
503
  - grammars/text.html.factor.json
502
504
  - grammars/text.html.ftl.json
503
505
  - grammars/text.html.handlebars.json
506
+ - grammars/text.html.js.json
504
507
  - grammars/text.html.jsp.json
505
508
  - grammars/text.html.liquid.json
506
509
  - grammars/text.html.mako.json
@@ -1,1510 +0,0 @@
1
- {
2
- "fileTypes": [
3
- "psc"
4
- ],
5
- "name": "Papyrus - Fallout 4",
6
- "patterns": [
7
- {
8
- "comment": "Empty line",
9
- "match": "^\\s*$",
10
- "name": "meta.emptyline.papyrus"
11
- },
12
- {
13
- "include": "#commentDocumentation"
14
- },
15
- {
16
- "include": "#commentBlock"
17
- },
18
- {
19
- "include": "#commentLine"
20
- },
21
- {
22
- "include": "#scriptHeader"
23
- },
24
- {
25
- "include": "#import"
26
- },
27
- {
28
- "include": "#group"
29
- },
30
- {
31
- "include": "#endgroup"
32
- },
33
- {
34
- "include": "#struct"
35
- },
36
- {
37
- "include": "#endstruct"
38
- },
39
- {
40
- "include": "#state"
41
- },
42
- {
43
- "include": "#endState"
44
- },
45
- {
46
- "include": "#event"
47
- },
48
- {
49
- "include": "#endEvent"
50
- },
51
- {
52
- "include": "#return"
53
- },
54
- {
55
- "include": "#if"
56
- },
57
- {
58
- "include": "#elseif"
59
- },
60
- {
61
- "include": "#else"
62
- },
63
- {
64
- "include": "#endIf"
65
- },
66
- {
67
- "include": "#while"
68
- },
69
- {
70
- "include": "#endWhile"
71
- },
72
- {
73
- "include": "#property"
74
- },
75
- {
76
- "include": "#endProperty"
77
- },
78
- {
79
- "include": "#function"
80
- },
81
- {
82
- "include": "#endFunction"
83
- },
84
- {
85
- "include": "#variable"
86
- },
87
- {
88
- "include": "#assign"
89
- },
90
- {
91
- "include": "#expression"
92
- },
93
- {
94
- "include": "#whitespace"
95
- },
96
- {
97
- "include": "#unmatched"
98
- }
99
- ],
100
- "repository": {
101
- "addExpression": {
102
- "patterns": [
103
- {
104
- "comment": "Addition or subtraction",
105
- "match": "(\\+|\\-)",
106
- "name": "keyword.operator.papyrus"
107
- },
108
- {
109
- "include": "#multExpression"
110
- }
111
- ]
112
- },
113
- "andExpression": {
114
- "patterns": [
115
- {
116
- "comment": "AND",
117
- "match": "\\&\\&",
118
- "name": "keyword.operator.papyrus"
119
- },
120
- {
121
- "include": "#boolExpression"
122
- }
123
- ]
124
- },
125
- "arrayAtom": {
126
- "patterns": [
127
- {
128
- "begin": "\\[",
129
- "comment": "Array",
130
- "end": "\\]",
131
- "name": "meta.array.papyrus",
132
- "patterns": [
133
- {
134
- "include": "#expression"
135
- }
136
- ]
137
- },
138
- {
139
- "include": "#atom"
140
- }
141
- ]
142
- },
143
- "arrayFuncOrId": {
144
- "patterns": [
145
- {
146
- "include": "#funcOrId"
147
- },
148
- {
149
- "begin": "\\[",
150
- "comment": "Array element access",
151
- "end": "\\]",
152
- "name": "meta.arrayelement.papyrus",
153
- "patterns": [
154
- {
155
- "include": "#expression"
156
- }
157
- ]
158
- }
159
- ]
160
- },
161
- "assign": {
162
- "patterns": [
163
- {
164
- "begin": "^\\s*",
165
- "comment": "Assign statement",
166
- "end": "([\\n\\r])",
167
- "name": "meta.assign.papyrus",
168
- "patterns": [
169
- {
170
- "include": "#assignmentOperators"
171
- },
172
- {
173
- "include": "#expression"
174
- },
175
- {
176
- "include": "#endOfLine"
177
- }
178
- ]
179
- }
180
- ]
181
- },
182
- "assignmentOperators": {
183
- "patterns": [
184
- {
185
- "comment": "Assignment operators",
186
- "match": "(\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=)",
187
- "name": "keyword.operator.papyrus"
188
- }
189
- ]
190
- },
191
- "atom": {
192
- "patterns": [
193
- {
194
- "begin": "(?i)\\b(new)\\s+(?:([_a-z][0-9_a-z]*)(\\:))?([_a-z][0-9_a-z]*)\\[",
195
- "beginCaptures": {
196
- "1": {
197
- "name": "keyword.operator.papyrus"
198
- },
199
- "2": {
200
- "name": "storage.type.papyrus"
201
- },
202
- "3": {
203
- "name": "keyword.operator.papyrus"
204
- },
205
- "4": {
206
- "name": "storage.type.papyrus"
207
- }
208
- },
209
- "comment": "New array",
210
- "end": "\\]",
211
- "name": "meta.newarray.papyrus",
212
- "patterns": [
213
- {
214
- "include": "#integer"
215
- }
216
- ]
217
- },
218
- {
219
- "begin": "\\(",
220
- "comment": "Parenthesis",
221
- "end": "(\\)|[\\n\\r])",
222
- "name": "meta.parenthesis.papyrus",
223
- "patterns": [
224
- {
225
- "include": "#expression"
226
- }
227
- ]
228
- },
229
- {
230
- "include": "#funcOrId"
231
- }
232
- ]
233
- },
234
- "baseTypes": {
235
- "patterns": [
236
- {
237
- "comment": "Type",
238
- "match": "(?i)\\b(bool|customevent|float|int|string|var)\\b",
239
- "name": "storage.type.papyrus"
240
- }
241
- ]
242
- },
243
- "bool": {
244
- "patterns": [
245
- {
246
- "comment": "Boolean literal",
247
- "match": "(?i)\\b(true|false|none)\\b",
248
- "name": "constant.language.boolean.papyrus"
249
- }
250
- ]
251
- },
252
- "boolExpression": {
253
- "patterns": [
254
- {
255
- "comment": "Comparison operators",
256
- "match": "(\\=\\=|\\!\\=|\\<\\=|\\>\\=|\\<|\\>)",
257
- "name": "keyword.operator.papyrus"
258
- },
259
- {
260
- "include": "#addExpression"
261
- }
262
- ]
263
- },
264
- "castAtom": {
265
- "patterns": [
266
- {
267
- "captures": {
268
- "1": {
269
- "name": "keyword.operator.papyrus"
270
- },
271
- "2": {
272
- "name": "storage.type.papyrus"
273
- },
274
- "3": {
275
- "name": "keyword.operator.papyrus"
276
- },
277
- "4": {
278
- "name": "storage.type.papyrus"
279
- }
280
- },
281
- "comment": "Cast",
282
- "match": "(?i)\\b(as)\\s+(?:([_a-z][0-9_a-z]*)(\\:))?([_a-z][0-9_a-z]*)\\b",
283
- "name": "meta.cast.papyrus"
284
- },
285
- {
286
- "include": "#dotAtom"
287
- }
288
- ]
289
- },
290
- "comma": {
291
- "patterns": [
292
- {
293
- "comment": "Comma",
294
- "match": "\\,",
295
- "name": "meta.comma.papyrus"
296
- }
297
- ]
298
- },
299
- "commentBlock": {
300
- "patterns": [
301
- {
302
- "begin": ";/",
303
- "comment": "Comment block",
304
- "end": "/;",
305
- "name": "comment.block.papyrus"
306
- }
307
- ]
308
- },
309
- "commentDocumentation": {
310
- "patterns": [
311
- {
312
- "begin": "^\\s*\\{",
313
- "comment": "Documentation comment",
314
- "end": "\\}",
315
- "name": "comment.documentation.papyrus"
316
- }
317
- ]
318
- },
319
- "commentLine": {
320
- "patterns": [
321
- {
322
- "comment": "Single line comment",
323
- "match": ";.*$",
324
- "name": "comment.line.papyrus"
325
- }
326
- ]
327
- },
328
- "comments": {
329
- "patterns": [
330
- {
331
- "include": "#commentBlock"
332
- },
333
- {
334
- "include": "#commentLine"
335
- },
336
- {
337
- "include": "#commentDocumentation"
338
- }
339
- ]
340
- },
341
- "constants": {
342
- "patterns": [
343
- {
344
- "include": "#bool"
345
- },
346
- {
347
- "include": "#float"
348
- },
349
- {
350
- "include": "#integer"
351
- },
352
- {
353
- "include": "#string"
354
- }
355
- ]
356
- },
357
- "dotAtom": {
358
- "patterns": [
359
- {
360
- "comment": "Dot",
361
- "match": "\\.",
362
- "name": "keyword.operator.papyrus"
363
- },
364
- {
365
- "include": "#constants"
366
- },
367
- {
368
- "include": "#arrayAtom"
369
- },
370
- {
371
- "include": "#arrayFuncOrId"
372
- }
373
- ]
374
- },
375
- "else": {
376
- "patterns": [
377
- {
378
- "begin": "(?i)^\\s*(else)\\b",
379
- "beginCaptures": {
380
- "1": {
381
- "name": "keyword.other.papyrus"
382
- }
383
- },
384
- "comment": "Else statement",
385
- "end": "([\\n\\r])",
386
- "name": "meta.else.papyrus",
387
- "patterns": [
388
- {
389
- "include": "#endOfLine"
390
- }
391
- ]
392
- }
393
- ]
394
- },
395
- "elseif": {
396
- "patterns": [
397
- {
398
- "begin": "(?i)^\\s*(elseif)\\b",
399
- "beginCaptures": {
400
- "1": {
401
- "name": "keyword.other.papyrus"
402
- }
403
- },
404
- "comment": "ElseIf statement",
405
- "end": "([\\n\\r])",
406
- "name": "meta.elseif.papyrus",
407
- "patterns": [
408
- {
409
- "include": "#expression"
410
- },
411
- {
412
- "include": "#endOfLine"
413
- }
414
- ]
415
- }
416
- ]
417
- },
418
- "endEvent": {
419
- "patterns": [
420
- {
421
- "begin": "(?i)^\\s*(endevent)\\b",
422
- "beginCaptures": {
423
- "1": {
424
- "name": "keyword.other.papyrus"
425
- }
426
- },
427
- "comment": "EndEvent statement",
428
- "end": "([\\n\\r])",
429
- "name": "meta.endevent.papyrus",
430
- "patterns": [
431
- {
432
- "include": "#endOfLine"
433
- }
434
- ]
435
- }
436
- ]
437
- },
438
- "endFunction": {
439
- "patterns": [
440
- {
441
- "begin": "(?i)^\\s*(endfunction)\\b",
442
- "beginCaptures": {
443
- "1": {
444
- "name": "keyword.other.papyrus"
445
- }
446
- },
447
- "comment": "EndFunction statement",
448
- "end": "([\\n\\r])",
449
- "name": "meta.endfunction.papyrus",
450
- "patterns": [
451
- {
452
- "include": "#endOfLine"
453
- }
454
- ]
455
- }
456
- ]
457
- },
458
- "endIf": {
459
- "patterns": [
460
- {
461
- "begin": "(?i)^\\s*(endif)\\b",
462
- "beginCaptures": {
463
- "1": {
464
- "name": "keyword.other.papyrus"
465
- }
466
- },
467
- "comment": "EndIf statement",
468
- "end": "([\\n\\r])",
469
- "name": "meta.endif.papyrus",
470
- "patterns": [
471
- {
472
- "include": "#endOfLine"
473
- }
474
- ]
475
- }
476
- ]
477
- },
478
- "endOfLine": {
479
- "patterns": [
480
- {
481
- "include": "#commentBlock"
482
- },
483
- {
484
- "include": "#commentLine"
485
- },
486
- {
487
- "include": "#whitespace"
488
- },
489
- {
490
- "include": "#multiline"
491
- },
492
- {
493
- "include": "#unmatched"
494
- }
495
- ]
496
- },
497
- "endProperty": {
498
- "patterns": [
499
- {
500
- "begin": "(?i)^\\s*(endproperty)\\b",
501
- "beginCaptures": {
502
- "1": {
503
- "name": "keyword.other.papyrus"
504
- }
505
- },
506
- "comment": "EndProperty statement",
507
- "end": "([\\n\\r])",
508
- "name": "meta.endproperty.papyrus",
509
- "patterns": [
510
- {
511
- "include": "#endOfLine"
512
- }
513
- ]
514
- }
515
- ]
516
- },
517
- "endState": {
518
- "patterns": [
519
- {
520
- "begin": "(?i)^\\s*(endstate)\\b",
521
- "beginCaptures": {
522
- "1": {
523
- "name": "keyword.other.papyrus"
524
- }
525
- },
526
- "comment": "EndState statement",
527
- "end": "([\\n\\r])",
528
- "name": "meta.endstate.papyrus",
529
- "patterns": [
530
- {
531
- "include": "#endOfLine"
532
- }
533
- ]
534
- }
535
- ]
536
- },
537
- "endWhile": {
538
- "patterns": [
539
- {
540
- "begin": "(?i)^\\s*(endwhile)\\b",
541
- "beginCaptures": {
542
- "1": {
543
- "name": "keyword.other.papyrus"
544
- }
545
- },
546
- "comment": "EndWhile statement",
547
- "end": "([\\n\\r])",
548
- "name": "meta.endwhile.papyrus",
549
- "patterns": [
550
- {
551
- "include": "#endOfLine"
552
- }
553
- ]
554
- }
555
- ]
556
- },
557
- "endgroup": {
558
- "patterns": [
559
- {
560
- "begin": "(?i)^\\s*(endgroup)\\b",
561
- "beginCaptures": {
562
- "1": {
563
- "name": "keyword.other.papyrus"
564
- }
565
- },
566
- "comment": "EndGroup statement",
567
- "end": "([\\n\\r])",
568
- "name": "meta.endgroup.papyrus",
569
- "patterns": [
570
- {
571
- "include": "#endOfLine"
572
- }
573
- ]
574
- }
575
- ]
576
- },
577
- "endstruct": {
578
- "patterns": [
579
- {
580
- "begin": "(?i)^\\s*(endstruct)\\b",
581
- "beginCaptures": {
582
- "1": {
583
- "name": "keyword.other.papyrus"
584
- }
585
- },
586
- "comment": "EndStruct statement",
587
- "end": "([\\n\\r])",
588
- "name": "meta.endstruct.papyrus",
589
- "patterns": [
590
- {
591
- "include": "#endOfLine"
592
- }
593
- ]
594
- }
595
- ]
596
- },
597
- "event": {
598
- "patterns": [
599
- {
600
- "begin": "(?i)^\\s*(event)\\s+",
601
- "beginCaptures": {
602
- "1": {
603
- "name": "keyword.control.eventstart.papyrus"
604
- },
605
- "2": {
606
- "name": "entity.name.function.papyrus"
607
- }
608
- },
609
- "comment": "Event declaration",
610
- "end": "([\\n\\r])",
611
- "name": "meta.event.papyrus",
612
- "patterns": [
613
- {
614
- "include": "#eventParameters"
615
- },
616
- {
617
- "include": "#eventFlags"
618
- },
619
- {
620
- "include": "#illegalKeywords"
621
- },
622
- {
623
- "include": "#illegalSpecialVariables"
624
- },
625
- {
626
- "include": "#illegalBaseTypes"
627
- },
628
- {
629
- "include": "#eventIdentifier"
630
- },
631
- {
632
- "include": "#endOfLine"
633
- }
634
- ]
635
- }
636
- ]
637
- },
638
- "eventFlags": {
639
- "patterns": [
640
- {
641
- "comment": "Event flags",
642
- "match": "(?i)(?<=\\))\\s*(native)\\b",
643
- "name": "keyword.other.papyrus"
644
- }
645
- ]
646
- },
647
- "eventIdentifier": {
648
- "patterns": [
649
- {
650
- "captures": {
651
- "1": {
652
- "name": "storage.type.papyrus"
653
- },
654
- "2": {
655
- "name": "keyword.operator.papyrus"
656
- },
657
- "3": {
658
- "name": "entity.name.function.papyrus"
659
- }
660
- },
661
- "comment": "Event identifier",
662
- "match": "(?i)\\b(?:([_a-z][0-9_a-z]*)(\\.))?([_a-z][0-9_a-z]*)(?=\\()",
663
- "name": "meta.name.event.papyrus"
664
- }
665
- ]
666
- },
667
- "eventParameter": {
668
- "patterns": [
669
- {
670
- "include": "#eventParameterIdentifier"
671
- },
672
- {
673
- "include": "#typeIdentifier"
674
- }
675
- ]
676
- },
677
- "eventParameterIdentifier": {
678
- "patterns": [
679
- {
680
- "comment": "Event parameter identifier",
681
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)))",
682
- "name": "variable.parameter.papyrus"
683
- }
684
- ]
685
- },
686
- "eventParameters": {
687
- "patterns": [
688
- {
689
- "begin": "\\(",
690
- "comment": "Event parameters",
691
- "end": "\\)",
692
- "name": "meta.eventparameters.papyrus",
693
- "patterns": [
694
- {
695
- "include": "#illegalKeywords"
696
- },
697
- {
698
- "include": "#illegalSpecialVariables"
699
- },
700
- {
701
- "include": "#eventParameter"
702
- },
703
- {
704
- "include": "#comma"
705
- },
706
- {
707
- "include": "#multiline"
708
- },
709
- {
710
- "include": "#whitespace"
711
- },
712
- {
713
- "include": "#unmatched"
714
- }
715
- ]
716
- }
717
- ]
718
- },
719
- "expression": {
720
- "patterns": [
721
- {
722
- "comment": "OR",
723
- "match": "\\|\\|",
724
- "name": "keyword.operator.papyrus"
725
- },
726
- {
727
- "include": "#andExpression"
728
- },
729
- {
730
- "include": "#endOfLine"
731
- }
732
- ]
733
- },
734
- "float": {
735
- "patterns": [
736
- {
737
- "include": "#unaryMinus"
738
- },
739
- {
740
- "comment": "Float literal",
741
- "match": "\\b(\\d+\\.\\d+)\\b",
742
- "name": "constant.numeric.float.papyrus"
743
- }
744
- ]
745
- },
746
- "funcOrId": {
747
- "patterns": [
748
- {
749
- "comment": "Length",
750
- "match": "(?i)\\b(length)\\b",
751
- "name": "keyword.other.papyrus"
752
- },
753
- {
754
- "include": "#functionCall"
755
- },
756
- {
757
- "include": "#illegalKeywords"
758
- },
759
- {
760
- "include": "#illegalBaseTypes"
761
- },
762
- {
763
- "include": "#specialVariables"
764
- },
765
- {
766
- "include": "#identifier"
767
- }
768
- ]
769
- },
770
- "function": {
771
- "patterns": [
772
- {
773
- "begin": "(?i)^\\s*(?:([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+)?(function)\\s+",
774
- "beginCaptures": {
775
- "1": {
776
- "name": "storage.type.papyrus"
777
- },
778
- "2": {
779
- "name": "keyword.control.functionstart.papyrus"
780
- },
781
- "3": {
782
- "name": "entity.name.function.papyrus"
783
- }
784
- },
785
- "comment": "Function declaration",
786
- "end": "([\\n\\r])",
787
- "name": "meta.function.papyrus",
788
- "patterns": [
789
- {
790
- "include": "#functionParameters"
791
- },
792
- {
793
- "include": "#functionFlags"
794
- },
795
- {
796
- "include": "#illegalKeywords"
797
- },
798
- {
799
- "include": "#illegalSpecialVariables"
800
- },
801
- {
802
- "include": "#illegalBaseTypes"
803
- },
804
- {
805
- "include": "#functionIdentifier"
806
- },
807
- {
808
- "include": "#endOfLine"
809
- }
810
- ]
811
- }
812
- ]
813
- },
814
- "functionCall": {
815
- "patterns": [
816
- {
817
- "begin": "(?i)\\b([_a-z][0-9_a-z]*)\\(",
818
- "beginCaptures": {
819
- "1": {
820
- "name": "variable.other.papyrus"
821
- }
822
- },
823
- "comment": "Function call",
824
- "end": "\\)",
825
- "name": "meta.functioncall.papyrus",
826
- "patterns": [
827
- {
828
- "include": "#functionCallParameters"
829
- }
830
- ]
831
- }
832
- ]
833
- },
834
- "functionCallParameter": {
835
- "patterns": [
836
- {
837
- "captures": {
838
- "1": {
839
- "name": "variable.parameter.papyrus"
840
- },
841
- "2": {
842
- "name": "keyword.operator.papyrus"
843
- }
844
- },
845
- "comment": "Specific parameter",
846
- "match": "(?i)\\b(?:([_a-z][0-9_a-z]*)\\s*(\\=))?",
847
- "name": "meta.functioncallparameter.papyrus"
848
- },
849
- {
850
- "include": "#expression"
851
- }
852
- ]
853
- },
854
- "functionCallParameters": {
855
- "patterns": [
856
- {
857
- "include": "#comma"
858
- },
859
- {
860
- "include": "#functionCallParameter"
861
- }
862
- ]
863
- },
864
- "functionFlags": {
865
- "patterns": [
866
- {
867
- "comment": "Function flags",
868
- "match": "(?i)\\b(betaonly|debugonly|global|native)\\b",
869
- "name": "keyword.other.papyrus"
870
- }
871
- ]
872
- },
873
- "functionIdentifier": {
874
- "patterns": [
875
- {
876
- "comment": "Function identifier",
877
- "match": "(?i)\\b([_a-z][0-9_a-z]*)(?=\\()",
878
- "name": "entity.name.function.papyrus"
879
- }
880
- ]
881
- },
882
- "functionParameter": {
883
- "patterns": [
884
- {
885
- "include": "#functionParameterIdentifier"
886
- },
887
- {
888
- "include": "#typeIdentifier"
889
- }
890
- ]
891
- },
892
- "functionParameterIdentifier": {
893
- "patterns": [
894
- {
895
- "comment": "Event parameter identifier",
896
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)|\\=))",
897
- "name": "variable.parameter.papyrus"
898
- }
899
- ]
900
- },
901
- "functionParameters": {
902
- "patterns": [
903
- {
904
- "begin": "\\(",
905
- "comment": "Function parameters",
906
- "end": "\\)",
907
- "name": "meta.functionparameters.papyrus",
908
- "patterns": [
909
- {
910
- "comment": "Assignment operator",
911
- "match": "(\\=)",
912
- "name": "keyword.operator.assignment.papyrus"
913
- },
914
- {
915
- "include": "#constants"
916
- },
917
- {
918
- "include": "#illegalKeywords"
919
- },
920
- {
921
- "include": "#illegalSpecialVariables"
922
- },
923
- {
924
- "include": "#functionParameter"
925
- },
926
- {
927
- "include": "#comma"
928
- },
929
- {
930
- "include": "#multiline"
931
- },
932
- {
933
- "include": "#whitespace"
934
- },
935
- {
936
- "include": "#unmatched"
937
- }
938
- ]
939
- }
940
- ]
941
- },
942
- "group": {
943
- "patterns": [
944
- {
945
- "begin": "(?i)^\\s*(group)\\s+",
946
- "beginCaptures": {
947
- "1": {
948
- "name": "keyword.other.papyrus"
949
- }
950
- },
951
- "comment": "Gourp declaration",
952
- "end": "([\\n\\r])",
953
- "name": "meta.group.papyrus",
954
- "patterns": [
955
- {
956
- "comment": "Group flags",
957
- "match": "(?i)\\b(collapsed|collapsedonref|collapsedonbase)\\b",
958
- "name": "keyword.other.papyrus"
959
- },
960
- {
961
- "include": "#illegalKeywords"
962
- },
963
- {
964
- "include": "#illegalSpecialVariables"
965
- },
966
- {
967
- "include": "#illegalBaseTypes"
968
- },
969
- {
970
- "include": "#identifier"
971
- },
972
- {
973
- "include": "#endOfLine"
974
- }
975
- ]
976
- }
977
- ]
978
- },
979
- "identifier": {
980
- "patterns": [
981
- {
982
- "comment": "Identifier",
983
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b",
984
- "name": "variable.other.papyrus"
985
- }
986
- ]
987
- },
988
- "if": {
989
- "patterns": [
990
- {
991
- "begin": "(?i)^\\s*(if)\\b",
992
- "beginCaptures": {
993
- "1": {
994
- "name": "keyword.other.papyrus"
995
- }
996
- },
997
- "comment": "If statement",
998
- "end": "([\\n\\r])",
999
- "name": "meta.if.papyrus",
1000
- "patterns": [
1001
- {
1002
- "include": "#expression"
1003
- },
1004
- {
1005
- "include": "#endOfLine"
1006
- }
1007
- ]
1008
- }
1009
- ]
1010
- },
1011
- "illegalBaseTypes": {
1012
- "patterns": [
1013
- {
1014
- "comment": "Type",
1015
- "match": "(?i)\\b(bool|customevent|float|int|string|var)\\b",
1016
- "name": "meta.invalid.papyrus"
1017
- }
1018
- ]
1019
- },
1020
- "illegalKeywords": {
1021
- "patterns": [
1022
- {
1023
- "comment": "Keywords",
1024
- "match": "(?i)\\b(as|auto|autoreadonly|betaonly|collapsed|collapsedonref|collapsedonbase|const|debugonly|default|else|elseif|endevent|endfunction|endgroup|endif|endproperty|endstate|endwhile|event|extends|false|function|global|group|if|import|length|mandatory|native|new|none|property|return|scriptname|state|true|while)\\b",
1025
- "name": "meta.invalid.papyrus"
1026
- }
1027
- ]
1028
- },
1029
- "illegalSpecialVariables": {
1030
- "patterns": [
1031
- {
1032
- "comment": "Special variables",
1033
- "match": "(?i)\\b(parent|self)\\b",
1034
- "name": "meta.invalid.papyrus"
1035
- }
1036
- ]
1037
- },
1038
- "import": {
1039
- "patterns": [
1040
- {
1041
- "begin": "(?i)^\\s*(import)\\s+",
1042
- "beginCaptures": {
1043
- "1": {
1044
- "name": "keyword.other.papyrus"
1045
- }
1046
- },
1047
- "comment": "Import statement",
1048
- "end": "([\\n\\r])",
1049
- "name": "meta.import.papyrus",
1050
- "patterns": [
1051
- {
1052
- "include": "#illegalKeywords"
1053
- },
1054
- {
1055
- "include": "#illegalSpecialVariables"
1056
- },
1057
- {
1058
- "include": "#illegalBaseTypes"
1059
- },
1060
- {
1061
- "include": "#typeIdentifier"
1062
- },
1063
- {
1064
- "include": "#endOfLine"
1065
- }
1066
- ]
1067
- }
1068
- ]
1069
- },
1070
- "integer": {
1071
- "patterns": [
1072
- {
1073
- "include": "#unaryMinus"
1074
- },
1075
- {
1076
- "comment": "Integer literal",
1077
- "match": "(?i)\\b(0x[0-9a-f]+|\\d+)\\b",
1078
- "name": "constant.numeric.integer.papyrus"
1079
- }
1080
- ]
1081
- },
1082
- "keywords": {
1083
- "patterns": [
1084
- {
1085
- "comment": "Keywords",
1086
- "match": "(?i)\\b(as|auto|autoreadonly|betaonly|collapsed|collapsedonref|collapsedonbase|const|debugonly|default|else|elseif|endevent|endfunction|endgroup|endif|endproperty|endstate|endwhile|event|extends|false|function|global|group|if|import|length|mandatory|native|new|none|property|return|scriptname|state|true|while)\\b",
1087
- "name": "keyword.other.papyrus"
1088
- }
1089
- ]
1090
- },
1091
- "multExpression": {
1092
- "patterns": [
1093
- {
1094
- "comment": "Multiplication, division, or modulus",
1095
- "match": "(\\*|/|\\%)",
1096
- "name": "keyword.operator.papyrus"
1097
- },
1098
- {
1099
- "include": "#unaryExpression"
1100
- }
1101
- ]
1102
- },
1103
- "multiline": {
1104
- "patterns": [
1105
- {
1106
- "begin": "\\\\",
1107
- "comment": "Multiline",
1108
- "end": "([\\n\\r])",
1109
- "name": "meta.multiline.papyrus",
1110
- "patterns": [
1111
- {
1112
- "include": "#commentBlock"
1113
- },
1114
- {
1115
- "include": "#commentLine"
1116
- },
1117
- {
1118
- "include": "#whitespace"
1119
- },
1120
- {
1121
- "include": "#unmatched"
1122
- }
1123
- ]
1124
- }
1125
- ]
1126
- },
1127
- "parameterIdentifier": {
1128
- "patterns": [
1129
- {
1130
- "comment": "Parameter identifier",
1131
- "match": "(?i)\\b([_a-z][0-9_a-z]*)\\b",
1132
- "name": "variable.parameter.papyrus"
1133
- }
1134
- ]
1135
- },
1136
- "property": {
1137
- "patterns": [
1138
- {
1139
- "begin": "(?i)^\\s*(?:([_a-z][0-9_a-z]*)(\\:))?([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+(property)\\s+",
1140
- "beginCaptures": {
1141
- "1": {
1142
- "name": "storage.type.papyrus"
1143
- },
1144
- "2": {
1145
- "name": "keyword.operator.papyrus"
1146
- },
1147
- "3": {
1148
- "name": "storage.type.papyrus"
1149
- },
1150
- "4": {
1151
- "name": "keyword.other.papyrus"
1152
- }
1153
- },
1154
- "comment": "Property declaration",
1155
- "end": "([\\n\\r])",
1156
- "name": "meta.property.papyrus",
1157
- "patterns": [
1158
- {
1159
- "comment": "Assignment operator",
1160
- "match": "(\\=)",
1161
- "name": "keyword.operator.assignment.papyrus"
1162
- },
1163
- {
1164
- "include": "#constants"
1165
- },
1166
- {
1167
- "include": "#propertyFlags"
1168
- },
1169
- {
1170
- "include": "#illegalKeywords"
1171
- },
1172
- {
1173
- "include": "#illegalSpecialVariables"
1174
- },
1175
- {
1176
- "include": "#illegalBaseTypes"
1177
- },
1178
- {
1179
- "include": "#identifier"
1180
- },
1181
- {
1182
- "include": "#endOfLine"
1183
- }
1184
- ]
1185
- }
1186
- ]
1187
- },
1188
- "propertyFlags": {
1189
- "patterns": [
1190
- {
1191
- "comment": "Property flags",
1192
- "match": "(?i)\\b(auto|autoreadonly|conditional|const|hidden|mandatory)\\b",
1193
- "name": "keyword.other.papyrus"
1194
- }
1195
- ]
1196
- },
1197
- "return": {
1198
- "patterns": [
1199
- {
1200
- "begin": "(?i)^\\s*(return)\\b",
1201
- "beginCaptures": {
1202
- "1": {
1203
- "name": "keyword.other.papyrus"
1204
- }
1205
- },
1206
- "comment": "Return statements",
1207
- "end": "([\\n\\r])",
1208
- "name": "meta.return.papyrus",
1209
- "patterns": [
1210
- {
1211
- "include": "#expression"
1212
- },
1213
- {
1214
- "include": "#endOfLine"
1215
- }
1216
- ]
1217
- }
1218
- ]
1219
- },
1220
- "scriptHeader": {
1221
- "patterns": [
1222
- {
1223
- "begin": "(?i)^\\s*(scriptname)\\s+",
1224
- "beginCaptures": {
1225
- "1": {
1226
- "name": "keyword.other.papyrus"
1227
- }
1228
- },
1229
- "comment": "Scriptheader",
1230
- "end": "([\\n\\r])",
1231
- "name": "meta.scriptheader.papyrus",
1232
- "patterns": [
1233
- {
1234
- "comment": "Script parent declaration",
1235
- "match": "(?i)\\b(extends)\\b",
1236
- "name": "keyword.other.papyrus"
1237
- },
1238
- {
1239
- "comment": "Script flags",
1240
- "match": "(?i)\\b(conditional|const|default|hidden|native)\\b",
1241
- "name": "keyword.other.papyrus"
1242
- },
1243
- {
1244
- "include": "#illegalKeywords"
1245
- },
1246
- {
1247
- "include": "#illegalSpecialVariables"
1248
- },
1249
- {
1250
- "include": "#illegalBaseTypes"
1251
- },
1252
- {
1253
- "include": "#typeIdentifier"
1254
- },
1255
- {
1256
- "include": "#endOfLine"
1257
- }
1258
- ]
1259
- }
1260
- ]
1261
- },
1262
- "specialVariables": {
1263
- "patterns": [
1264
- {
1265
- "comment": "Special variables",
1266
- "match": "(?i)\\b(parent|self)\\b",
1267
- "name": "keyword.other.papyrus"
1268
- }
1269
- ]
1270
- },
1271
- "state": {
1272
- "patterns": [
1273
- {
1274
- "begin": "(?i)^\\s*(?:(auto)\\s+)?(state)\\s+",
1275
- "beginCaptures": {
1276
- "1": {
1277
- "name": "keyword.other.papyrus"
1278
- },
1279
- "2": {
1280
- "name": "keyword.other.papyrus"
1281
- }
1282
- },
1283
- "comment": "State declaration",
1284
- "end": "([\\n\\r])",
1285
- "name": "meta.state.papyrus",
1286
- "patterns": [
1287
- {
1288
- "include": "#illegalKeywords"
1289
- },
1290
- {
1291
- "include": "#illegalSpecialVariables"
1292
- },
1293
- {
1294
- "include": "#illegalBaseTypes"
1295
- },
1296
- {
1297
- "include": "#identifier"
1298
- },
1299
- {
1300
- "include": "#endOfLine"
1301
- }
1302
- ]
1303
- }
1304
- ]
1305
- },
1306
- "string": {
1307
- "patterns": [
1308
- {
1309
- "begin": "\\\"",
1310
- "comment": "String literal",
1311
- "end": "\\\"",
1312
- "name": "string.quoted.double",
1313
- "patterns": [
1314
- {
1315
- "comment": "Escape sequences",
1316
- "match": "(\\\\.)",
1317
- "name": "constant.character.escape.papyrus"
1318
- }
1319
- ]
1320
- }
1321
- ]
1322
- },
1323
- "struct": {
1324
- "patterns": [
1325
- {
1326
- "begin": "(?i)^\\s*(struct)\\s+",
1327
- "beginCaptures": {
1328
- "1": {
1329
- "name": "keyword.other.papyrus"
1330
- }
1331
- },
1332
- "comment": "Struct declaration",
1333
- "end": "([\\n\\r])",
1334
- "name": "meta.struct.papyrus",
1335
- "patterns": [
1336
- {
1337
- "include": "#illegalKeywords"
1338
- },
1339
- {
1340
- "include": "#illegalSpecialVariables"
1341
- },
1342
- {
1343
- "include": "#illegalBaseTypes"
1344
- },
1345
- {
1346
- "include": "#identifier"
1347
- },
1348
- {
1349
- "include": "#endOfLine"
1350
- }
1351
- ]
1352
- }
1353
- ]
1354
- },
1355
- "typeIdentifier": {
1356
- "patterns": [
1357
- {
1358
- "captures": {
1359
- "1": {
1360
- "name": "storage.type.papyrus"
1361
- },
1362
- "2": {
1363
- "name": "keyword.operator.papyrus"
1364
- },
1365
- "3": {
1366
- "name": "storage.type.papyrus"
1367
- }
1368
- },
1369
- "comment": "Type identifier",
1370
- "match": "(?i)\\b(?:([_a-z][0-9_a-z]*)(\\:))?([_a-z][0-9_a-z]*)\\b",
1371
- "name": "storage.type.papyrus"
1372
- }
1373
- ]
1374
- },
1375
- "unaryExpression": {
1376
- "patterns": [
1377
- {
1378
- "comment": "Unary minus or NOT",
1379
- "match": "(\\-|\\!)",
1380
- "name": "keyword.operator.papyrus"
1381
- },
1382
- {
1383
- "include": "#castAtom"
1384
- }
1385
- ]
1386
- },
1387
- "unaryMinus": {
1388
- "patterns": [
1389
- {
1390
- "comment": "Unary minus",
1391
- "match": "\\-(?=\\d)",
1392
- "name": "keyword.operator.papyrus"
1393
- }
1394
- ]
1395
- },
1396
- "unmatched": {
1397
- "patterns": [
1398
- {
1399
- "comment": "Unmatched",
1400
- "match": "([^\\n\\r])",
1401
- "name": "meta.invalid.papyrus"
1402
- }
1403
- ]
1404
- },
1405
- "variable": {
1406
- "patterns": [
1407
- {
1408
- "begin": "(?i)^\\s*(?:([_a-z][0-9_a-z]*)(\\:))?([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s*(\\=)\\s*)",
1409
- "beginCaptures": {
1410
- "1": {
1411
- "name": "storage.type.papyrus"
1412
- },
1413
- "2": {
1414
- "name": "keyword.operator.papyrus"
1415
- },
1416
- "3": {
1417
- "name": "storage.type.papyrus"
1418
- },
1419
- "4": {
1420
- "name": "variable.other.papyrus"
1421
- },
1422
- "5": {
1423
- "name": "keyword.operator.papyrus"
1424
- }
1425
- },
1426
- "comment": "Variable declaration with a default value",
1427
- "end": "([\\n\\r])",
1428
- "name": "meta.variable.papyrus",
1429
- "patterns": [
1430
- {
1431
- "include": "#constants"
1432
- },
1433
- {
1434
- "match": "(?i)(?:\\b(conditional|const)\\b)",
1435
- "name": "keyword.other.papyrus"
1436
- },
1437
- {
1438
- "include": "#expression"
1439
- },
1440
- {
1441
- "include": "#endOfLine"
1442
- }
1443
- ]
1444
- },
1445
- {
1446
- "begin": "(?i)^\\s*(?:([_a-z][0-9_a-z]*)(\\:))?([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s+(conditional|const)\\b)?",
1447
- "beginCaptures": {
1448
- "1": {
1449
- "name": "storage.type.papyrus"
1450
- },
1451
- "2": {
1452
- "name": "keyword.operator.papyrus"
1453
- },
1454
- "3": {
1455
- "name": "storage.type.papyrus"
1456
- },
1457
- "4": {
1458
- "name": "variable.other.papyrus"
1459
- },
1460
- "5": {
1461
- "name": "keyword.operator.papyrus"
1462
- }
1463
- },
1464
- "comment": "Scriptwide variable declaration without a default value",
1465
- "end": "([\\n\\r])",
1466
- "name": "meta.variable.papyrus",
1467
- "patterns": [
1468
- {
1469
- "include": "#endOfLine"
1470
- }
1471
- ]
1472
- }
1473
- ]
1474
- },
1475
- "while": {
1476
- "patterns": [
1477
- {
1478
- "begin": "(?i)^\\s*(while)\\b",
1479
- "beginCaptures": {
1480
- "1": {
1481
- "name": "keyword.other.papyrus"
1482
- }
1483
- },
1484
- "comment": "While statement",
1485
- "end": "([\\n\\r])",
1486
- "name": "meta.while.papyrus",
1487
- "patterns": [
1488
- {
1489
- "include": "#expression"
1490
- },
1491
- {
1492
- "include": "#endOfLine"
1493
- }
1494
- ]
1495
- }
1496
- ]
1497
- },
1498
- "whitespace": {
1499
- "patterns": [
1500
- {
1501
- "comment": "Whitespace",
1502
- "match": "([ \\t])",
1503
- "name": "meta.whitespace.papyrus"
1504
- }
1505
- ]
1506
- }
1507
- },
1508
- "scopeName": "source.papyrus.fallout4",
1509
- "uuid": "c3a48958-a5a3-4e6e-9434-ec86a0656c29"
1510
- }