file-expert 1.1.0

Expert system for recognizing source code files, similar to GitHub/lingust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
//
// $COPYRIGHT$: 794d8002d1b6d954e2302879cb69c215d893c60c
use fancy_regex::Regex;
use lazy_static::lazy_static;

lazy_static! {
    static ref APACHECONF_1: Regex = Regex::new(r#"^\s*<(?:VirtualHost|Directory)\b"#).unwrap();
    static ref APEX_1: Regex = Regex::new(r#"^\s*(?:private|public|protected|global)\s+(?:(?:with|without) sharing\s+)?class\b"#).unwrap();
    static ref ACTIONSCRIPT_1: Regex = Regex::new(r#"^\s*(?:package(?:\s+[\w.]+)?\s+(?:{|$)|import\s+[\w.*]+\s*;|(?=.*?(?:intrinsic|extends))(intrinsic\s+)?class\s+[\w<>.]+(?:\s+extends\s+[\w<>.]+)?|(?:(?:public|protected|private|static)\s+)*(?:(?:var|const|local)\s+\w+\s*:\s*[\w<>.]+(?:\s*=.*)?\s*;|function\s+\w+\s*\((?:\s*\w+\s*:\s*[\w<>.]+\s*(,\s*\w+\s*:\s*[\w<>.]+\s*)*)?\)))"#).unwrap();
    static ref AGS_SCRIPT_1: Regex = Regex::new(r#"^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])"#).unwrap();
    static ref AL_1: Regex = Regex::new(r#"\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN))\b"#).unwrap();
    static ref ASCIIDOC_1: Regex = Regex::new(r#"^[=-]+(\s|\n)|{{[A-Za-z]"#).unwrap();
    static ref BASIC: Regex = Regex::new(r#"^\s*\d+"#).unwrap();
    static ref BEEF_1: Regex = Regex::new(r#"^\s*(class|namespace|void|static)\b"#).unwrap();
    static ref BITBAKE_1: Regex = Regex::new(r#"^\s*(# |include|require)\b"#).unwrap();
    static ref BLITZBASIC_1: Regex = Regex::new(r#"(<^\s*; |End Function)"#).unwrap();
    static ref BRAINFUCK_1: Regex = Regex::new(r#"(?:\+|>|<){4,}"#).unwrap();
    static ref COMMON_LISP_1: Regex = Regex::new(r#"^\s*\((?i:defun|in-package|defpackage) "#).unwrap();
    static ref COMMON_LISP_2: Regex = Regex::new(r#"\(def(un|macro)\s"#).unwrap();
    static ref COMMON_LISP_3: Regex = Regex::new(r#"^\s*\((?i:defun|in-package|defpackage) "#).unwrap();
    static ref COOL_1: Regex = Regex::new(r#"^class"#).unwrap();
    static ref COQ_1: Regex = Regex::new(r#"(?:^|\s)(?:Proof|Qed)\.(?:$|\s)|(?:^|\s)Require[ \t]+(Import|Export)\s"#).unwrap();
    static ref CUE_SHEET_1: Regex = Regex::new(r#"^\s*TRACK\s\d+\s.*$"#).unwrap();
    static ref CPP_1: Regex = Regex::new(r#"^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>"#).unwrap();
    static ref CPP_2: Regex = Regex::new(r#"^\s*template\s*<"#).unwrap();
    static ref CPP_3: Regex = Regex::new(r#"^[ \t]*(try|constexpr)"#).unwrap();
    static ref CPP_4: Regex = Regex::new(r#"^[ \t]*catch\s*\("#).unwrap();
    static ref CPP_5: Regex = Regex::new(r#"^[ \t]*(class|(using[ \t]+)?namespace)\s+\w+"#).unwrap();
    static ref CPP_6: Regex = Regex::new(r#"^[ \t]*(private|public|protected):$"#).unwrap();
    static ref CPP_7: Regex = Regex::new(r#"std::\w+"#).unwrap();
    static ref CWEB_1: Regex = Regex::new(r#"^@(<|\w+\.)"#).unwrap();
    static ref C_PLUS__PLUS__1: Regex = Regex::new(r#"^\s*#(?:(?:if|ifdef|define|pragma)\s+\w|\s*include\s+<[^>]+>)"#).unwrap();
    static ref C_PLUS__PLUS__2: Regex = Regex::new(r#"^\s*template\s*<"#).unwrap();
    static ref C_SHARP__1: Regex = Regex::new(r#"^\s*(?:namespace|using|\/\/)\s*[\w\.]+\s*"#).unwrap();
    static ref DIRECTX_3D_FILE_1: Regex = Regex::new(r#"^xof 030(2|3)(?:txt|bin|tzip|bzip)\b"#).unwrap();
    static ref DTRACE_1: Regex = Regex::new(r#"^(\w+:\w*:\w*:\w*|BEGIN|END|provider\s+|(tick|profile)-\w+\s+{[^}]*}|#pragma\s+D\s+(option|attributes|depends_on)\s|#pragma\s+ident\s)"#).unwrap();
    static ref D_1: Regex = Regex::new(r#"^module\s+[\w.]*\s*;|import\s+[\w\s,.:]*;|\w+\s+\w+\s*\(.*\)(?:\(.*\))?\s*{[^}]*}|unittest\s*(?:\(.*\))?\s*{[^}]*}"#).unwrap();
    static ref EAGLE_1: Regex = Regex::new(r#"^\s*<!DOCTYPE\s+eagle\b"#).unwrap();
    static ref ECLIPSE_1: Regex = Regex::new(r#"^[^#]+:-"#).unwrap();
    static ref ECL_1: Regex = Regex::new(r#":="#).unwrap();
    static ref EIFFEL_1: Regex = Regex::new(r#"^(note|class|feature|end|inherit)"#).unwrap();
    static ref ERLANG_1: Regex = Regex::new(r#"^\s*(?:%%|main\s*\(.*?\)\s*->)"#).unwrap();
    static ref FAUST_1: Regex = Regex::new(r#"\bprocess\s*[(=]|\b(library|import)\s*\(\s*\"|\bdeclare\s+(name|version|author|copyright|license)\s+\""#).unwrap();
    static ref FILEBENCH_WML_1: Regex = Regex::new(r#"flowop"#).unwrap();
    static ref FILTERSCRIPT_1: Regex = Regex::new(r#"#include|#pragma\s+(rs|version)|__attribute__"#).unwrap();
    static ref FLUX_1: Regex = Regex::new(r#"^\s*(typedef|atomic)\b"#).unwrap();
    static ref FLUENT: Regex = Regex::new(r#"^-?[a-zA-Z][a-zA-Z0-9_-]* *=|\{\$-?[a-zA-Z][-\w]*(?:\.[a-zA-Z][-\w]*)?\}"#).unwrap();
    static ref FREE_BASIC: Regex = Regex::new(r#"^[ \t]*#(?:define|endif|endmacro|ifn?def|if|include|lang|macro)\s"#).unwrap();
    static ref FREE_MARKER: Regex = Regex::new(r#"^(?:<|[a-zA-Z-][a-zA-Z0-9_-]+[ \t]+\w)|\${\w+[^\n]*?}|^[ \t]*(?:<#--.*?-->|<#([a-z]+)(?=\s|>)[^>]*>.*?</#\1>|\[#--.*?--\]|\[#([a-z]+)(?=\s|\])[^\]]*\].*?\[#\2\])"#).unwrap();
    static ref FORTH_1: Regex = Regex::new(r#"^: "#).unwrap();
    static ref FORTH_2: Regex = Regex::new(r#"^: "#).unwrap();
    static ref FORTH_3: Regex = Regex::new(r#"^(: |also |new-device|previous )"#).unwrap();
    static ref FORTH_4: Regex = Regex::new(r#"^(: |new-device)"#).unwrap();
    static ref FORTRAN_1: Regex = Regex::new(r#"^(?i:[c*][^abd-z]|      (subroutine|program|end|data)\s|\s*!)"#).unwrap();
    static ref FREGE_1: Regex = Regex::new(r#"^\s*(import|module|package|data|type) "#).unwrap();
    static ref F_SHARP__1: Regex = Regex::new(r#"^\s*(#light|import|let|module|namespace|open|type)"#).unwrap();
    static ref GAP_1: Regex = Regex::new(r#"\s*(Declare|BindGlobal|KeyDependentOperation)"#).unwrap();
    static ref GAP_2: Regex = Regex::new(r#"gap> "#).unwrap();
    static ref GAP_3: Regex = Regex::new(r#"\s+:=\s+"#).unwrap();
    static ref GCC_MACHINE_DESCRIPTION_1: Regex = Regex::new(r#"^(;;|\(define_)"#).unwrap();
    static ref GDSCRIPT_1: Regex = Regex::new(r#"\s*(extends|var|const|enum|func|class|signal|tool|yield|assert|onready)"#).unwrap();
    static ref GENIE_1: Regex = Regex::new(r#"^\[indent=[0-9]+\]"#).unwrap();
    static ref GENIE_2: Regex = Regex::new(r#"^\t*(def|class|construct|init)\b"#).unwrap();
    static ref GENIE_3: Regex = Regex::new(r#"^(init|import)\b"#).unwrap();
    static ref GERBER_IMAGE_1: Regex = Regex::new(r#"^[DGMT][0-9]{2}\*$"#).unwrap();
    static ref GLSL_1: Regex = Regex::new(r#"^\s*(#version|precision|uniform|varying|vec[234])"#).unwrap();
    static ref GLSL_2: Regex = Regex::new(r#"^#version\s+[0-9]+\b"#).unwrap();
    static ref GNUPLOT_1: Regex = Regex::new(r#"^s?plot\b"#).unwrap();
    static ref GNUPLOT_2: Regex = Regex::new(r#"^set\s+(term|terminal|out|output|[xy]tics|[xy]label|[xy]range|style)\b"#).unwrap();
    static ref GOSU_1: Regex = Regex::new(r#"^uses (java|gw)\."#).unwrap();
    static ref GRAPH_MODELING_LANGUAGE_1: Regex = Regex::new(r#"(?i:^\s*(graph|node)\b\s*\[?$)"#).unwrap();
    static ref HACK_1: Regex = Regex::new(r#"<\?hh"#).unwrap();
    static ref HACK_2: Regex = Regex::new(r#"<\?hh"#).unwrap();
    static ref HAPROXY_1: Regex = Regex::new(r#"^\s*(?:frontend|backend|listen)\s+(?:\w|\d)+"#).unwrap();
    static ref HIVEQL_1: Regex = Regex::new(r#"(?i:SELECT\s+[\w*,]+\s+FROM|(CREATE|ALTER|DROP)\s(DATABASE|SCHEMA|TABLE))"#).unwrap();
    static ref HTML_1: Regex = Regex::new(r#"^\s*</?(?i:html|head|title|body|span|div)\b"#).unwrap();
    static ref IDL_1: Regex = Regex::new(r#"^\s*function[ \w,]+$"#).unwrap();
    static ref INI_1: Regex = Regex::new(r#"last_client="#).unwrap();
    static ref INI_2: Regex = Regex::new(r#"^[;\[]"#).unwrap();
    static ref JASMIN_1: Regex = Regex::new(r#"^\.\w+\b"#).unwrap();
    static ref JAVASCRIPT_1: Regex = Regex::new(r#"(?m:\/\/|(\"|')use strict\1|export\s+default\s|\/\*.*?\*\/)"#).unwrap();
    static ref JAVA_PROPERTIES_1: Regex = Regex::new(r#"^[^#!][^:]*:"#).unwrap();
    static ref JSON_1: Regex = Regex::new(r#"\A\s*[{\[]"#).unwrap();
    static ref JSON_2: Regex = Regex::new(r#"\"modelName\"\:\s*\"GM"#).unwrap();
    static ref JSONIQ: Regex = Regex::new(r#"(^\s*(import\s+module|variable\s+\$\w+))"#).unwrap();
    static ref KEY_EQUALS_VALUE_1: Regex = Regex::new(r#"^[^#!;][^=]*="#).unwrap();
    static ref KUSTO_1: Regex = Regex::new(r#"(^\|\s*(where|extend|project|limit|summarize))|(^\.\w+)"#).unwrap();
    static ref LEX_1: Regex = Regex::new(r#"^(%[%{}]xs|<.*>)"#).unwrap();
    static ref LIMBO_1: Regex = Regex::new(r#"^\w+\s*:\s*module\s*{?$"#).unwrap();
    static ref LINKER_SCRIPT_1: Regex = Regex::new(r#"OUTPUT_ARCH\(|OUTPUT_FORMAT\(|SECTIONS"#).unwrap();
    static ref LINUX_KERNEL_MODULE_1: Regex = Regex::new(r#"^.+\.ko"#).unwrap();
    static ref LOGOS_1: Regex = Regex::new(r#"^%(end|ctor|hook|group)\b"#).unwrap();
    static ref LOOMSCRIPT_1: Regex = Regex::new(r#"^\s*package\s*[\w\.\/\*\s]*\s*{?$"#).unwrap();
    static ref LTSPICE_SYMBOL_1: Regex = Regex::new(r#"^SymbolType[ \t]"#).unwrap();
    static ref M4SUGAR_1: Regex = Regex::new(r#"AC_DEFUN|AC_PREREQ|AC_INIT"#).unwrap();
    static ref M4SUGAR_2: Regex = Regex::new(r#"^_?m4_"#).unwrap();
    static ref M68K_1: Regex = Regex::new(r#"(?im)\bmoveq(?:\.l)?\s+#(?:\$-?[0-9a-f]{1,3}|%[0-1]{1,8}|-?[0-9]{1,3}),\s*d[0-7]\b"#).unwrap();
    static ref M68K_2: Regex = Regex::new(r#"(?im)^\s*move(?:\.[bwl])?\s+(?:sr|usp),\s*[^\s]+"#).unwrap();
    static ref M68K_3: Regex = Regex::new(r#"(?im)^\s*move\.[bwl]\s+.*\b[ad]\d"#).unwrap();
    static ref M68K_4: Regex = Regex::new(r#"(?im)^\s*movem\.[bwl]\b"#).unwrap();
    static ref M68K_5: Regex = Regex::new(r#"(?im)^\s*move[mp](?:\.[wl])?\b"#).unwrap();
    static ref M68K_6: Regex = Regex::new(r#"(?im)^\s*btst\b"#).unwrap();
    static ref M68K_7: Regex = Regex::new(r#"(?im)^\s*dbra\b"#).unwrap();
    static ref MAKEFILE_1: Regex = Regex::new(r#"([\/\\].*:\s+.*\s\\$|: \\$|^[ %]:|^[\w\s\/\\.]+\w+\.\w+\s*:\s+[\w\s\/\\.]+\w+\.\w+)"#).unwrap();
    static ref MAN_HEADING_1: Regex = Regex::new(r#"^[.'][ \t]*SH +(?:[^\"\s]+|\"[^\"\s]+)"#).unwrap();
    static ref MAN_TITLE_1: Regex = Regex::new(r#"^[.'][ \t]*TH +(?:[^\"\s]+|\"[^\"]+\") +\"?(?:[1-9]|@[^\s@]+@)"#).unwrap();
    static ref MARKDOWN_1: Regex = Regex::new(r#"(^[-A-Za-z0-9=#!\*\[|>])|<\/"#).unwrap();
    static ref MARKDOWN_2: Regex = Regex::new(r#"\A\z"#).unwrap();
    static ref MATHEMATICA_1: Regex = Regex::new(r#"\(\*"#).unwrap();
    static ref MATHEMATICA_2: Regex = Regex::new(r#"\*\)$"#).unwrap();
    static ref MATLAB_1: Regex = Regex::new(r#"^\s*%"#).unwrap();
    static ref MATLAB_2: Regex = Regex::new(r#"^\s*end\b"#).unwrap();
    static ref MDOC_DATE_1: Regex = Regex::new(r#"^[.'][ \t]*Dd +(?:[^\"\s]+|\"[^\"]+\")"#).unwrap();
    static ref MDOC_HEADING_1: Regex = Regex::new(r#"^[.'][ \t]*Sh +(?:[^\"\s]|\"[^\"]+\")"#).unwrap();
    static ref MDOC_TITLE_1: Regex = Regex::new(r#"^[.'][ \t]*Dt +(?:[^\"\s]+|\"[^\"]+\") +\"?(?:[1-9]|@[^\s@]+@)"#).unwrap();
    static ref MERCURY_1: Regex = Regex::new(r#":-\s+\w+"#).unwrap();
    static ref MICROSOFT_DEVELOPER_STUDIO_PROJECT_1: Regex = Regex::new(r#"# Microsoft Developer Studio Generated Build File"#).unwrap();
    static ref MODULA_2_1: Regex = Regex::new(r#"^\s*(?i:MODULE|END) [\w\.]+;"#).unwrap();
    static ref MOOCODE_1: Regex = Regex::new(r#"^\s*@\w+\s+"#).unwrap();
    static ref MOTOKO: Regex = Regex::new(r#"\b(func|shared)\b"#).unwrap();
    static ref MUF_1: Regex = Regex::new(r#"^: "#).unwrap();
    static ref M_1: Regex = Regex::new(r#"^\s*;"#).unwrap();
    static ref NASL_1: Regex = Regex::new(r#"^\s*include\s*\(\s*(?:\"|')[\\/\w\-\.:\s]+\.(?:nasl|inc)\s*(?:\"|')\s*\)\s*;"#).unwrap();
    static ref NASL_2: Regex = Regex::new(r#"^\s*(?:global|local)_var\s+(?:\w+(?:\s*=\s*[\w\-\"']+)?\s*)(?:,\s*\w+(?:\s*=\s*[\w\-\"']+)?\s*)*+\s*;"#).unwrap();
    static ref NASL_3: Regex = Regex::new(r#"^\s*namespace\s+\w+\s*{"#).unwrap();
    static ref NASL_4: Regex = Regex::new(r#"^\s*object\s+\w+\s*(?:extends\s+\w+(?:::\w+)?)?\s*{"#).unwrap();
    static ref NASL_5: Regex = Regex::new(r#"^\s*(?:public\s+|private\s+|\s*)function\s+\w+\s*\([\w\s,]*\)\s*{"#).unwrap();
    static ref NEMERLE_1: Regex = Regex::new(r#"^(module|namespace|using)\s"#).unwrap();
    static ref NEWLISP_1: Regex = Regex::new(r#"^\s*\(define "#).unwrap();
    static ref NL_1: Regex = Regex::new(r#"^(b|g)[0-9]+ "#).unwrap();
    static ref OBJECTIVEC_1: Regex = Regex::new(r#"^\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\b|#import\s+.+\.h[\">])"#).unwrap();
    static ref OBJECTIVEC_2: Regex = Regex::new(r#"^\s*#\s*(?:include|import)\s+<(?:CoreVideo|Foundation|Cocoa|CoreFoundation)/.*\.h>\s*$"#).unwrap();
    static ref OBJECTSCRIPT_1: Regex = Regex::new(r#"^Class\s"#).unwrap();
    static ref OBJECT_DATA_INSTANCE_NOTATION_1: Regex = Regex::new(r#"(?:^|<)\s*[A-Za-z0-9_]+\s*=\s*<"#).unwrap();
    static ref OCAML_1: Regex = Regex::new(r#"(^\s*module)|let rec |match\s+(\S+\s)+with"#).unwrap();
    static ref ODIN_1: Regex = Regex::new(r#"package\s+\w+|\b(?:im|ex)port\s*\"[\w:./]+\"|\w+\s*::\s*(?:proc|struct)\s*\(|^\s*//\s"#).unwrap();
    static ref OPENCL_1: Regex = Regex::new(r#"\/\* |\/\/ |^\}"#).unwrap();
    static ref OPENEDGE_ABL_1: Regex = Regex::new(r#"&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS"#).unwrap();
    static ref PASCAL_1: Regex = Regex::new(r#"^\s*end[.;]\s*$"#).unwrap();
    static ref PASCAL_2: Regex = Regex::new(r#"(?i:^\s*{\$(?:mode|ifdef|undef|define)[ ]+[a-z0-9_]+})"#).unwrap();
    static ref PAWN_1: Regex = Regex::new(r#"^\s*#include\s+<\w+>"#).unwrap();
    static ref PAWN_2: Regex = Regex::new(r#"^\s*public\s+(?:\w|\d)+\("#).unwrap();
    static ref PAWN_3: Regex = Regex::new(r#"^\s*stock\s+(?:\w|\d)+:"#).unwrap();
    static ref PERL5_1: Regex = Regex::new(r#"\buse\s+(?:strict\b|sigtrap\b|v?5\.)"#).unwrap();
    static ref PERL6_1: Regex = Regex::new(r#"^\s*(?:use\s+v6\b|\bmodule\b|\b(?:my\s+)?class\b)"#).unwrap();
    static ref PHP_1: Regex = Regex::new(r#"^<\?(?:php)?"#).unwrap();
    static ref PHP_2: Regex = Regex::new(r#"<\?[^h]"#).unwrap();
    static ref PICOLISP_1: Regex = Regex::new(r#"^\((de|class|rel|code|data|must)\s"#).unwrap();
    static ref PLPGSQL_1: Regex = Regex::new(r#"(?i:^\\i\b|AS\s+\$\$|LANGUAGE\s+'?plpgsql'?|BEGIN(\s+WORK)?\s*;)"#).unwrap();
    static ref PLSQL_1: Regex = Regex::new(r#"(?i:\$\$PLSQL_|XMLTYPE|systimestamp|\.nextval|CONNECT\s+BY|AUTHID\s+(DEFINER|CURRENT_USER)|constructor\W+function)"#).unwrap();
    static ref POD_6_1: Regex = Regex::new(r#"^[\s&&[^\n]]*=(comment|begin pod|begin para|item\d+)"#).unwrap();
    static ref POV_RAY_SDL_1: Regex = Regex::new(r#"^\s*#(declare|local|macro|while)\s"#).unwrap();
    static ref PROGUARD_1: Regex = Regex::new(r#"^-(include\b.*\.pro$|keep\b|keepclassmembers\b|keepattributes\b)"#).unwrap();
    static ref PROLOG_1: Regex = Regex::new(r#"^[^#]*:-"#).unwrap();
    static ref PUBLIC_KEY_1: Regex = Regex::new(r#"^(----[- ]BEGIN|ssh-(rsa|dss)) "#).unwrap();
    static ref PUPPET_1: Regex = Regex::new(r#"^\s+\w+\s+=>\s"#).unwrap();
    static ref PYTHON_1: Regex = Regex::new(r#"(?m:^(import|from|class|def)\s)"#).unwrap();
    static ref PYTHON_SPEC_1: Regex = Regex::new(r#"=\s*Analysis\("#).unwrap();
    static ref PYTHON_SPEC_2: Regex = Regex::new(r#"=\s*PYZ\("#).unwrap();
    static ref PYTHON_SPEC_3: Regex = Regex::new(r#"=\s*EXE\("#).unwrap();
    static ref PYTHON_SPEC_4: Regex = Regex::new(r#"=\s*COLLECT\("#).unwrap();
    static ref QMAKE_1: Regex = Regex::new(r#"HEADERS"#).unwrap();
    static ref QMAKE_2: Regex = Regex::new(r#"SOURCES"#).unwrap();
    static ref QT_SCRIPT_1: Regex = Regex::new(r#"(\w+\.prototype\.\w+|===|\bvar\b)"#).unwrap();
    static ref Q_1: Regex = Regex::new(r#"((?i:[A-Z.][\w.]*:{)|(^|\n)\\(cd?|d|l|p|ts?) )"#).unwrap();
    static ref Q_SHARP__1: Regex = Regex::new(r#"^((\/{2,3})?\s*(namespace|operation)\b)"#).unwrap();
    static ref RAKU_1: Regex = Regex::new(r#"^\s*(?:use\s+v6\b|\bmodule\b|\bmy\s+class\b)"#).unwrap();
    static ref REASON_1: Regex = Regex::new(r#"^\s*module\s+type\s"#).unwrap();
    static ref REASON_2: Regex = Regex::new(r#"^\s*(?:include|open)\s+\w+\s*;\s*$"#).unwrap();
    static ref REASON_3: Regex = Regex::new(r#"^\s*let\s+(?:module\s\w+\s*=\s*{|\w+:\s+.*=.*;\s*$)"#).unwrap();
    static ref REBOL_1: Regex = Regex::new(r#"(?i:\bRebol\b)"#).unwrap();
    static ref RENDERSCRIPT_1: Regex = Regex::new(r#"#include|#pragma\s+(rs|version)|__attribute__"#).unwrap();
    static ref RESCRIPT_1: Regex = Regex::new(r#"^\s*(let|module|type)\s+\w*\s+=\s+"#).unwrap();
    static ref RESCRIPT_2: Regex = Regex::new(r#"^\s*(?:include|open)\s+\w+\s*$"#).unwrap();
    static ref ROFF_1: Regex = Regex::new(r#"^\.(?:[A-Za-z]{2}(?:\s|$)|\\\")"#).unwrap();
    static ref ROFF_2: Regex = Regex::new(r#"^\.[A-Za-z]{2}(\s|$)"#).unwrap();
    static ref ROFF_3: Regex = Regex::new(r#"^[.'][A-Za-z]{2}(\s|$)"#).unwrap();
    static ref ROFF_4: Regex = Regex::new(r#"^[.']"#).unwrap();
    static ref ROFF_5: Regex = Regex::new(r#"^\.\\\" "#).unwrap();
    static ref RPC_1: Regex = Regex::new(r#"\b(program|version)\s+\w+\s*{|\bunion\s+\w+\s+switch\s*\("#).unwrap();
    static ref RPM_SPEC_1: Regex = Regex::new(r#"\s*Name\:\s*\w+"#).unwrap();
    static ref RUNOFF_1: Regex = Regex::new(r#"(?i:^\.!|^\f|\f$|^\.end lit(?:eral)?\b|^\.[a-zA-Z].*?;\.[a-zA-Z](?:[; \t])|\^\*[^\s*][^*]*\\\*(?=$|\s)|^\.c;[ \t]*\w+)"#).unwrap();
    static ref RUST_1: Regex = Regex::new(r#"^(use |fn |mod |pub |macro_rules|impl|#!?\[)"#).unwrap();
    static ref R_1: Regex = Regex::new(r#"<-|^\s*#"#).unwrap();
    static ref SCALA_1: Regex = Regex::new(r#"(^\s*import (scala|java)\.|^\s*class\b)"#).unwrap();
    static ref SCHEME_1: Regex = Regex::new(r#"^\s*\((?:define|let)"#).unwrap();
    static ref SLICE_1: Regex = Regex::new(r#"^\s*(module|struct|interface|sequence|enum)\s+\w+"#).unwrap();
    static ref SMALLTALK_2: Regex = Regex::new(r#"\A\s*[\[{(^\"'\w#]|[a-zA-Z_]\w*\s*:=\s*[a-zA-Z_]\w*|class\s*>>\s*[a-zA-Z_]\w*|^[a-zA-Z_]\w*\s+[a-zA-Z_]\w*:|^Class\s*{|if(?:True|False):\s*\["#).unwrap();
    static ref SMALLTALK_1: Regex = Regex::new(r#"![\w\s]+methodsFor: "#).unwrap();
    static ref SOLIDITY_1: Regex = Regex::new(r#"\bpragma\s+solidity\b|\b(?:abstract\s+)?contract\s+(?!\d)[a-zA-Z0-9$_]+(?:\s+is\s+(?:[a-zA-Z0-9$_][^\{]*?)?)?\s*\{"#).unwrap();
    static ref SOURCEPAWN_1: Regex = Regex::new(r#"^public\s+(?:SharedPlugin(?:\s+|:)__pl_\w+\s*=(?:\s*{)?|(?:void\s+)?__pl_\w+_SetNTVOptional\(\)(?:\s*{)?)"#).unwrap();
    static ref SOURCEPAWN_2: Regex = Regex::new(r#"^methodmap\s+\w+\s+<\s+\w+"#).unwrap();
    static ref SOURCEPAWN_3: Regex = Regex::new(r#"^\s*MarkNativeAsOptional\s*\("#).unwrap();
    static ref SQLPL_1: Regex = Regex::new(r#"(?i:ALTER\s+MODULE|MODE\s+DB2SQL|\bSYS(CAT|PROC)\.|ASSOCIATE\s+RESULT\s+SET|\bEND!\s*$)"#).unwrap();
    static ref STANDARD_ML_1: Regex = Regex::new(r#"=> |case\s+(\S+\s)+of"#).unwrap();
    static ref STRING_TEMPLATE: Regex = Regex::new(r#"\$\w+[($]|(.)!\s*.+?\s*!\1|<!\s*.+?\s*!>|\[!\s*.+?\s*!\]|\{!\s*.+?\s*!\}"#).unwrap();
    static ref SUBRIP_TEXT_1: Regex = Regex::new(r#"^(\d{2}:\d{2}:\d{2},\d{3})\s*(-->)\s*(\d{2}:\d{2}:\d{2},\d{3})$"#).unwrap();
    static ref SUPERCOLLIDER_1: Regex = Regex::new(r#"(?i:\^(this|super)\.|^\s*~\w+\s*=\.)"#).unwrap();
    static ref SWIG_1: Regex = Regex::new(r#"^[ \t]*%[a-z_]+\b|^%[{}]$"#).unwrap();
    static ref TEXT_1: Regex = Regex::new(r#"THE_TITLE"#).unwrap();
    static ref TEX_1: Regex = Regex::new(r#"\\\w+{"#).unwrap();
    static ref TEX_2: Regex = Regex::new(r#"^\\(contentsline|defcounter|beamer|boolfalse)"#).unwrap();
    static ref TSQL_1: Regex = Regex::new(r#"(?i:^\s*GO\b|BEGIN(\s+TRY|\s+CATCH)|OUTPUT\s+INSERTED|DECLARE\s+@|\[dbo\])"#).unwrap();
    static ref TSX_1: Regex = Regex::new(r#"^\s*(import.+(from\s+|require\()['\"]react|\/\/\/\s*<reference\s)"#).unwrap();
    static ref TURING_1: Regex = Regex::new(r#"^\s*%[ \t]+|^\s*var\s+\w+(\s*:\s*\w+)?\s*:=\s*\w+"#).unwrap();
    static ref UNITY3D_ASSET_1: Regex = Regex::new(r#"tag:unity3d.com"#).unwrap();
    static ref UNIX_ASSEMBLY_1: Regex = Regex::new(r#"^\s*\.(?:include\s|globa?l\s|[A-Za-z][_A-Za-z0-9]*:)"#).unwrap();
    static ref VERILOG_1: Regex = Regex::new(r#"^[ \t]*module\s+[^\s()]+\s+\#?\(|^[ \t]*`(?:define|ifdef|ifndef|include|timescale)|^[ \t]*always[ \t]+@|^[ \t]*initial[ \t]+(begin|@)"#).unwrap();
    static ref VBA_1: Regex = Regex::new(r#"^\s*End\s+(?:If|Sub|Function|Select|Enum|Property)"#).unwrap();
    static ref VIM_HELP_FILE_1: Regex = Regex::new(r#"(?:(?:^|[ \t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \t]ex)(?=:(?=[ \t]*set?[ \t][^\r\n:]+:)|:(?![ \t]*set?[ \t]))(?:(?:[ \t]*:[ \t]*|[ \t])\w*(?:[ \t]*=(?:[^\\\s]|\\.)*)?)*[ \t:](?:filetype|ft|syntax)[ \t]*=(help)(?=$|\s|:)"#).unwrap();
    static ref VIM_SCRIPT_1: Regex = Regex::new(r#"^UseVimball"#).unwrap();
    static ref V_1: Regex = Regex::new(r#"\$(?:if|else)[ \t]|^[ \t]*fn\s+[^\s()]+\(.*?\).*?\{|^[ \t]*for\s*\{"#).unwrap();
    static ref WORLD_OF_WARCRAFT_ADDON_DATA_1: Regex = Regex::new(r#"^## |@no-lib-strip@"#).unwrap();
    static ref XBASE_1: Regex = Regex::new(r#"^\s*#\s*(?i:if|ifdef|ifndef|define|command|xcommand|translate|xtranslate|include|pragma|undef)\b"#).unwrap();
    static ref XML_1: Regex = Regex::new(r#"^(\s*)(?i:<Project|<Import|<Property|<?xml|xmlns)"#).unwrap();
    static ref XML_2: Regex = Regex::new(r#"(?i:^\s*(<\?xml|xmlns))"#).unwrap();
    static ref XML_3: Regex = Regex::new(r#"<!ENTITY "#).unwrap();
    static ref XML_4: Regex = Regex::new(r#"^\s*<\?xml\s+version"#).unwrap();
    static ref XML_5: Regex = Regex::new(r#"^\s*<\?xml"#).unwrap();
    static ref XML_6: Regex = Regex::new(r#"<TS\b"#).unwrap();
    static ref XML_7: Regex = Regex::new(r#"(?i:^\s*<\?xml\s+version)"#).unwrap();
    static ref XML_8: Regex = Regex::new(r#"^\s*<\w+\b"#).unwrap();
    static ref XML_PROPERTY_LIST_1: Regex = Regex::new(r#"<!DOCTYPE\s+plist"#).unwrap();
    static ref X_PIXMAP_1: Regex = Regex::new(r#"^\s*\/\* XPM \*\/"#).unwrap();
}

#[allow(clippy::too_many_lines)]
#[allow(clippy::match_same_arms)]
#[allow(clippy::if_same_then_else)]
pub fn linguist_heuristic(ext: &str, content: &[String]) -> Option<&'static str> {
    match ext {
        ".1" | ".2" | ".3" | ".4" | ".5" | ".6" | ".7" | ".8" | ".9" => {
            if match_lines(&MDOC_DATE_1, content)
                && match_lines(&MDOC_TITLE_1, content)
                && match_lines(&MDOC_HEADING_1, content)
            {
                Some("Roff Manpage")
            } else if match_lines(&MAN_TITLE_1, content) && match_lines(&MAN_HEADING_1, content) {
                Some("Roff Manpage")
            } else if match_lines(&ROFF_1, content) {
                Some("Roff")
            } else {
                None
            }
        }
        ".1in" | ".1m" | ".1x" | ".3in" | ".3m" | ".3p" | ".3pm" | ".3qt" | ".3x" | ".man"
        | ".mdoc" => {
            if match_lines(&MDOC_DATE_1, content)
                && match_lines(&MDOC_TITLE_1, content)
                && match_lines(&MDOC_HEADING_1, content)
            {
                Some("Roff Manpage")
            } else if match_lines(&MAN_TITLE_1, content) && match_lines(&MAN_HEADING_1, content) {
                Some("Roff Manpage")
            } else {
                Some("Roff")
            }
        }
        ".al" => {
            if match_lines(&AL_1, content) {
                Some("AL")
            } else {
                Some("Perl")
            }
        }
        ".as" => {
            if match_lines(&ACTIONSCRIPT_1, content) {
                Some("ActionScript")
            } else {
                Some("AngelScript")
            }
        }
        ".asc" => {
            if match_lines(&PUBLIC_KEY_1, content) {
                Some("Public Key")
            } else if match_lines(&ASCIIDOC_1, content) {
                Some("AsciiDoc")
            } else if match_lines(&AGS_SCRIPT_1, content) {
                Some("AGS Script")
            } else {
                None
            }
        }
        ".asm" => {
            if match_lines(&M68K_1, content)
                || match_lines(&M68K_2, content)
                || match_lines(&M68K_3, content)
                || match_lines(&M68K_4, content)
                || match_lines(&M68K_5, content)
                || match_lines(&M68K_6, content)
                || match_lines(&M68K_7, content)
            {
                Some("Motorola 68K Assembly")
            } else {
                Some("Assembly")
            }
        }
        ".asy" => {
            if match_lines(&LTSPICE_SYMBOL_1, content) {
                Some("LTspice Symbol")
            } else {
                Some("Asymptote")
            }
        }
        ".bas" => {
            if match_lines(&FREE_BASIC, content) {
                Some("FreeBasic")
            } else if match_lines(&BASIC, content) {
                Some("BASIC")
            } else {
                Some("VBA")
            }
        }
        ".bb" => {
            if match_lines(&BLITZBASIC_1, content) {
                Some("BlitzBasic")
            } else if match_lines(&BITBAKE_1, content) {
                Some("BitBake")
            } else {
                None
            }
        }
        ".brd" => {
            if match_lines(&EAGLE_1, content) {
                Some("Eagle")
            } else {
                Some("KiCad Legacy Layout")
            }
        }
        ".builds" => {
            if match_lines(&XML_1, content) {
                Some("XML")
            } else {
                None
            }
        }
        ".cake" => {
            if match_lines(&C_SHARP__1, content) {
                Some("C#")
            } else {
                Some("CoffeeScript")
            }
        }
        ".cfg" => {
            if match_lines(&HAPROXY_1, content) {
                Some("HAProxy")
            } else {
                Some("INI")
            }
        }
        ".ch" => {
            if match_lines(&XBASE_1, content) {
                Some("xBase")
            } else {
                Some("Charity")
            }
        }
        ".cl" => {
            if match_lines(&COMMON_LISP_1, content) {
                Some("Common Lisp")
            } else if match_lines(&COOL_1, content) {
                Some("Cool")
            } else if match_lines(&OPENCL_1, content) {
                Some("OpenCL")
            } else {
                None
            }
        }
        ".cls" => {
            if match_lines(&TEX_1, content) {
                Some("TeX")
            } else if match_lines(&OBJECTSCRIPT_1, content) {
                Some("ObjectScript")
            } else if match_lines(&APEX_1, content) {
                Some("Apex")
            } else if match_lines(&VBA_1, content) {
                Some("VBA")
            } else {
                Some("OpenEdge ABL")
            }
        }
        ".cmp" => {
            if match_lines(&GERBER_IMAGE_1, content) {
                Some("Gerber Image")
            } else {
                None
            }
        }
        ".cp" => {
            if match_lines(&CPP_1, content)
                || match_lines(&CPP_2, content)
                || match_lines(&CPP_3, content)
                || match_lines(&CPP_4, content)
                || match_lines(&CPP_5, content)
                || match_lines(&CPP_6, content)
                || match_lines(&CPP_7, content)
            {
                Some("C++")
            } else {
                Some("Component Pascal")
            }
        }
        ".cs" => {
            if match_lines(&SMALLTALK_1, content) {
                Some("Smalltalk")
            } else if match_lines(&C_SHARP__1, content) {
                Some("C#")
            } else {
                None
            }
        }
        ".csl" => {
            if match_lines(&XML_2, content) {
                Some("XML")
            } else if match_lines(&KUSTO_1, content) {
                Some("Kusto")
            } else {
                None
            }
        }
        ".cue" => {
            if match_lines(&CUE_SHEET_1, content) {
                Some("Cue Sheet")
            } else {
                Some("CUE")
            }
        }
        ".d" => {
            if match_lines(&DTRACE_1, content) {
                Some("DTrace")
            } else if match_lines(&MAKEFILE_1, content) {
                Some("Makefile")
            } else {
                Some("D")
            }
        }
        ".ddl" => {
            if match_lines(&PLSQL_1, content) {
                Some("PLSQL")
            } else {
                Some("SQL")
            }
        }
        ".xml.dist" => {
            if match_lines(&XML_5, content) {
                Some("XML")
            } else {
                None
            }
        }
        ".dll.config" => {
            if match_lines(&XML_8, content) {
                Some("XML")
            } else {
                None
            }
        }
        ".dsp" => {
            if match_lines(&MICROSOFT_DEVELOPER_STUDIO_PROJECT_1, content) {
                Some("Microsoft Developer Studio Project")
            } else if match_lines(&FAUST_1, content) {
                Some("Faust")
            } else {
                None
            }
        }
        ".e" => {
            if match_lines(&EIFFEL_1, content) {
                Some("Eiffel")
            } else {
                Some("E")
            }
        }
        ".ecl" => {
            if match_lines(&ECLIPSE_1, content) {
                Some("ECLiPSe")
            } else if match_lines(&ECL_1, content) {
                Some("ECL")
            } else {
                None
            }
        }
        ".es" => {
            if match_lines(&ERLANG_1, content) {
                Some("Erlang")
            } else if match_lines(&JAVASCRIPT_1, content) {
                Some("JavaScript")
            } else {
                None
            }
        }
        ".f" => {
            if match_lines(&FORTH_1, content) {
                Some("Forth")
            } else if match_lines(&FILEBENCH_WML_1, content) {
                Some("Filebench WML")
            } else if match_lines(&FORTRAN_1, content) {
                Some("Fortran")
            } else {
                None
            }
        }
        ".fcgi" => {
            if match_lines(&PHP_1, content) {
                Some("PHP")
            } else if match_lines(&PYTHON_1, content) {
                Some("Python")
            } else {
                None
            }
        }
        ".for" => {
            if match_lines(&FORTH_2, content) {
                Some("Forth")
            } else if match_lines(&FORTRAN_1, content) {
                Some("Fortran")
            } else {
                Some("Formatted")
            }
        }
        ".fr" => {
            if match_lines(&FORTH_3, content) {
                Some("Forth")
            } else if match_lines(&FREGE_1, content) {
                Some("Frege")
            } else {
                Some("Text")
            }
        }
        ".frag" => {
            if match_lines(&GLSL_1, content) {
                Some("GLSL")
            } else {
                Some("JavaScript")
            }
        }
        ".fs" => {
            if match_lines(&FORTH_4, content) {
                Some("Forth")
            } else if match_lines(&F_SHARP__1, content) {
                Some("F#")
            } else if match_lines(&GLSL_1, content) {
                Some("GLSL")
            } else if match_lines(&FILTERSCRIPT_1, content) {
                Some("Filterscript")
            } else {
                None
            }
        }
        ".ftl" => {
            if match_lines(&FREE_MARKER, content) {
                Some("FreeMarker")
            } else if match_lines(&FLUENT, content) {
                Some("Fluent")
            } else {
                None
            }
        }
        ".fx" => {
            if match_lines(&FLUX_1, content) {
                Some("FLUX")
            } else {
                Some("HLSL")
            }
        }
        ".g" => {
            if match_lines(&GAP_3, content) {
                Some("GAP")
            } else {
                Some("G-code")
            }
        }
        ".gd" => {
            if match_lines(&GAP_1, content) {
                Some("GAP")
            } else if match_lines(&GDSCRIPT_1, content) {
                Some("GDScript")
            } else {
                None
            }
        }
        ".gml" => {
            if match_lines(&XML_2, content) {
                Some("XML")
            } else if match_lines(&GRAPH_MODELING_LANGUAGE_1, content) {
                Some("Graph Modeling Language")
            } else if match_lines(&GERBER_IMAGE_1, content) {
                Some("Gerber Image")
            } else {
                Some("Game Maker Language")
            }
        }
        ".gs" => {
            if match_lines(&GLSL_2, content) {
                Some("GLSL")
            } else if match_lines(&GOSU_1, content) {
                Some("Gosu")
            } else if match_lines(&GENIE_1, content)
                || match_lines(&GENIE_2, content)
                || match_lines(&GENIE_3, content)
            {
                Some("Genie")
            } else {
                Some("JavaScript")
            }
        }
        ".gst" => {
            if match_lines(&XML_5, content) {
                Some("XML")
            } else {
                Some("Gosu")
            }
        }
        ".h" => {
            if match_lines(&OBJECTIVEC_1, content) {
                Some("Objective-C")
            } else if match_lines(&CPP_1, content)
                || match_lines(&CPP_2, content)
                || match_lines(&CPP_3, content)
                || match_lines(&CPP_4, content)
                || match_lines(&CPP_5, content)
                || match_lines(&CPP_6, content)
                || match_lines(&CPP_7, content)
            {
                Some("C++")
            } else {
                Some("C")
            }
        }
        ".hh" => {
            if match_lines(&HACK_1, content) {
                Some("Hack")
            } else if match_lines(&CPP_1, content)
                || match_lines(&CPP_2, content)
                || match_lines(&CPP_3, content)
                || match_lines(&CPP_4, content)
                || match_lines(&CPP_5, content)
                || match_lines(&CPP_6, content)
                || match_lines(&CPP_7, content)
            {
                Some("C++")
            } else {
                None
            }
        }
        ".html.hl" => {
            if match_lines(&HTML_1, content) {
                Some("HTML")
            } else {
                None
            }
        }
        ".i" => {
            if match_lines(&M68K_1, content)
                || match_lines(&M68K_2, content)
                || match_lines(&M68K_3, content)
                || match_lines(&M68K_4, content)
                || match_lines(&M68K_5, content)
                || match_lines(&M68K_6, content)
                || match_lines(&M68K_7, content)
            {
                Some("Motorola 68K Assembly")
            } else if match_lines(&SWIG_1, content) {
                Some("SWIG")
            } else {
                Some("Assembly")
            }
        }
        ".ice" => {
            if match_lines(&SLICE_1, content) {
                Some("Slice")
            } else if match_lines(&JSON_1, content) {
                Some("JSON")
            } else {
                None
            }
        }
        ".inc" => {
            if match_lines(&M68K_1, content)
                || match_lines(&M68K_2, content)
                || match_lines(&M68K_3, content)
                || match_lines(&M68K_4, content)
                || match_lines(&M68K_5, content)
                || match_lines(&M68K_6, content)
                || match_lines(&M68K_7, content)
            {
                Some("Motorola 68K Assembly")
            } else if match_lines(&PHP_1, content) {
                Some("PHP")
            } else if match_lines(&SOURCEPAWN_1, content)
                || match_lines(&SOURCEPAWN_2, content)
                || match_lines(&SOURCEPAWN_3, content)
            {
                Some("SourcePawn")
            } else if match_lines(&NASL_1, content)
                || match_lines(&NASL_2, content)
                || match_lines(&NASL_3, content)
                || match_lines(&NASL_4, content)
                || match_lines(&NASL_5, content)
            {
                Some("NASL")
            } else if match_lines(&POV_RAY_SDL_1, content) {
                Some("POV-Ray SDL")
            } else if match_lines(&CPP_1, content)
                || match_lines(&CPP_2, content)
                || match_lines(&CPP_3, content)
                || match_lines(&CPP_4, content)
                || match_lines(&CPP_5, content)
                || match_lines(&CPP_6, content)
                || match_lines(&CPP_7, content)
            {
                Some("C++")
            } else if match_lines(&HTML_1, content) {
                Some("HTML")
            } else if match_lines(&PASCAL_1, content) || match_lines(&PASCAL_2, content) {
                Some("Pascal")
            } else if match_lines(&PAWN_1, content)
                || match_lines(&PAWN_2, content)
                || match_lines(&PAWN_3, content)
            {
                Some("Pawn")
            } else {
                Some("Assembly")
            }
        }
        ".j" => {
            if match_lines(&JASMIN_1, content) {
                Some("Jasmin")
            } else {
                Some("Objective-J")
            }
        }
        ".jq" => {
            if match_lines(&JSONIQ, content) {
                Some("JSONiq")
            } else {
                Some("jq")
            }
        }
        ".l" => {
            if match_lines(&COMMON_LISP_2, content) {
                Some("Common Lisp")
            } else if match_lines(&LEX_1, content) {
                Some("Lex")
            } else if match_lines(&ROFF_2, content) {
                Some("Roff")
            } else if match_lines(&PICOLISP_1, content) {
                Some("PicoLisp")
            } else {
                None
            }
        }
        ".ls" => {
            if match_lines(&LOOMSCRIPT_1, content) {
                Some("LoomScript")
            } else {
                Some("LiveScript")
            }
        }
        ".lsp" | ".lisp" => {
            if match_lines(&COMMON_LISP_3, content) {
                Some("Common Lisp")
            } else if match_lines(&NEWLISP_1, content) {
                Some("NewLisp")
            } else {
                None
            }
        }
        ".m" => {
            if match_lines(&OBJECTIVEC_1, content) || match_lines(&OBJECTIVEC_2, content) {
                Some("Objective-C")
            } else if match_lines(&MERCURY_1, content) {
                Some("Mercury")
            } else if match_lines(&MUF_1, content) {
                Some("MUF")
            } else if match_lines(&M_1, content) {
                Some("M")
            } else if match_lines(&MATHEMATICA_1, content) && match_lines(&MATHEMATICA_2, content) {
                Some("Mathematica")
            } else if match_lines(&MATLAB_1, content) || match_lines(&MATLAB_2, content) {
                Some("MATLAB")
            } else if match_lines(&LIMBO_1, content) {
                Some("Limbo")
            } else {
                Some("M")
            }
        }
        ".m4" => {
            if match_lines(&M4SUGAR_1, content) || match_lines(&M4SUGAR_2, content) {
                Some("M4Sugar")
            } else {
                Some("M4")
            }
        }
        ".mask" => {
            if match_lines(&UNITY3D_ASSET_1, content) {
                Some("Unity3D Asset")
            } else {
                Some("Mask")
            }
        }
        ".md" => {
            if match_lines(&GCC_MACHINE_DESCRIPTION_1, content) {
                Some("GCC Machine Description")
            } else {
                Some("Markdown")
            }
        }
        ".ml" => {
            if match_lines(&OCAML_1, content) {
                Some("OCaml")
            } else if match_lines(&STANDARD_ML_1, content) {
                Some("Standard ML")
            } else {
                Some("OCaml")
            }
        }
        ".mm" => {
            if match_lines(&XML_8, content) {
                Some("XML")
            } else {
                Some("Objective-C++")
            }
        }
        ".mod" => {
            if match_lines(&XML_3, content) {
                Some("XML")
            } else if match_lines(&MODULA_2_1, content) {
                Some("Modula-2")
            } else if match_lines(&LINUX_KERNEL_MODULE_1, content) {
                Some("Linux Kernel Module")
            } else {
                Some("AMPL")
            }
        }
        ".mo" => {
            if match_lines(&MOTOKO, content) {
                Some("Motoko")
            } else {
                Some("Modelica")
            }
        }
        ".moo" => {
            if match_lines(&MOOCODE_1, content) {
                Some("Moocode")
            } else if match_lines(&MERCURY_1, content) {
                Some("Mercury")
            } else {
                None
            }
        }
        ".ms" => {
            if match_lines(&ROFF_3, content) {
                Some("Roff")
            } else if match_lines(&UNIX_ASSEMBLY_1, content) {
                Some("Unix Assembly")
            } else {
                Some("MAXScript")
            }
        }
        ".n" => {
            if match_lines(&ROFF_4, content) {
                Some("Roff")
            } else if match_lines(&NEMERLE_1, content) {
                Some("Nemerle")
            } else {
                None
            }
        }
        ".ncl" => {
            if match_lines(&XML_4, content) {
                Some("XML")
            } else if match_lines(&GERBER_IMAGE_1, content) {
                Some("Gerber Image")
            } else if match_lines(&TEXT_1, content) {
                Some("Text")
            } else {
                Some("NCL")
            }
        }
        ".nb" => {
            if match_lines(&MATHEMATICA_1, content) || match_lines(&MATHEMATICA_2, content) {
                Some("Mathematica")
            } else {
                Some("Text")
            }
        }
        ".nl" => {
            if match_lines(&NL_1, content) {
                Some("NL")
            } else {
                Some("NewLisp")
            }
        }
        ".odin" => {
            if match_lines(&OBJECT_DATA_INSTANCE_NOTATION_1, content) {
                Some("Object Data Instance Notation")
            } else if match_lines(&ODIN_1, content) {
                Some("Odin")
            } else {
                None
            }
        }
        ".p" => {
            if match_lines(&GNUPLOT_1, content) || match_lines(&GNUPLOT_2, content) {
                Some("Gnuplot")
            } else {
                Some("OpenEdge ABL")
            }
        }
        ".php" => {
            if match_lines(&HACK_2, content) {
                Some("Hack")
            } else if match_lines(&PHP_2, content) {
                Some("PHP")
            } else {
                None
            }
        }
        ".pl" => {
            if match_lines(&PROLOG_1, content) {
                Some("Prolog")
            } else if match_lines(&PERL5_1, content) {
                Some("Perl")
            } else if match_lines(&PERL6_1, content) {
                Some("Raku")
            } else {
                None
            }
        }
        ".plist" => {
            if match_lines(&XML_PROPERTY_LIST_1, content) {
                Some("XML Property List")
            } else {
                Some("OpenStep Property List")
            }
        }
        ".pluginspec" => {
            if match_lines(&XML_8, content) {
                Some("XML")
            } else {
                Some("Ruby")
            }
        }
        ".pm" => {
            if match_lines(&PERL5_1, content) {
                Some("Perl")
            } else if match_lines(&PERL6_1, content) {
                Some("Raku")
            } else if match_lines(&X_PIXMAP_1, content) {
                Some("X PixMap")
            } else {
                None
            }
        }
        ".pod" => {
            if match_lines(&POD_6_1, content) {
                Some("Pod 6")
            } else {
                Some("Pod")
            }
        }
        ".pp" => {
            if match_lines(&PASCAL_1, content) || match_lines(&PASCAL_2, content) {
                Some("Pascal")
            } else {
                Some("Puppet")
            }
        }
        ".prc" => {
            if match_lines(&PLSQL_1, content) {
                Some("PLSQL")
            } else {
                Some("SQL")
            }
        }
        ".pro" => {
            if match_lines(&PROGUARD_1, content) {
                Some("Proguard")
            } else if match_lines(&PROLOG_1, content) {
                Some("Prolog")
            } else if match_lines(&INI_1, content) {
                Some("INI")
            } else if match_lines(&QMAKE_1, content) && match_lines(&QMAKE_2, content) {
                Some("QMake")
            } else if match_lines(&IDL_1, content) {
                Some("IDL")
            } else {
                None
            }
        }
        ".properties" => {
            if match_lines(&KEY_EQUALS_VALUE_1, content) && match_lines(&INI_2, content) {
                Some("INI")
            } else if match_lines(&KEY_EQUALS_VALUE_1, content)
                && match_lines(&JAVA_PROPERTIES_1, content)
            {
                Some("Java Properties")
            } else if match_lines(&KEY_EQUALS_VALUE_1, content) {
                Some("INI")
            } else if match_lines(&JAVA_PROPERTIES_1, content) {
                Some("Java Properties")
            } else {
                None
            }
        }
        ".q" => {
            if match_lines(&Q_1, content) {
                Some("q")
            } else if match_lines(&HIVEQL_1, content) {
                Some("HiveQL")
            } else {
                None
            }
        }
        ".qs" => {
            if match_lines(&Q_SHARP__1, content) {
                Some("Q#")
            } else if match_lines(&QT_SCRIPT_1, content) {
                Some("Qt Script")
            } else {
                None
            }
        }
        ".r" => {
            if match_lines(&REBOL_1, content) {
                Some("Rebol")
            } else if match_lines(&R_1, content) {
                Some("R")
            } else {
                None
            }
        }
        ".re" => {
            if match_lines(&REASON_1, content)
                || match_lines(&REASON_2, content)
                || match_lines(&REASON_3, content)
            {
                Some("Reason")
            } else if match_lines(&C_PLUS__PLUS__1, content)
                || match_lines(&C_PLUS__PLUS__2, content)
            {
                Some("C++")
            } else {
                None
            }
        }
        ".res" => {
            if match_lines(&RESCRIPT_1, content) || match_lines(&RESCRIPT_2, content) {
                Some("ReScript")
            } else if match_lines(&XML_5, content) {
                Some("XML")
            } else {
                None
            }
        }
        ".rno" => {
            if match_lines(&RUNOFF_1, content) {
                Some("RUNOFF")
            } else if match_lines(&ROFF_5, content) {
                Some("Roff")
            } else {
                None
            }
        }
        ".rpy" => {
            if match_lines(&PYTHON_1, content) {
                Some("Python")
            } else {
                Some("Ren'Py")
            }
        }
        ".rs" => {
            if match_lines(&RUST_1, content) {
                Some("Rust")
            } else if match_lines(&RENDERSCRIPT_1, content) {
                Some("RenderScript")
            } else if match_lines(&XML_5, content) {
                Some("XML")
            } else {
                None
            }
        }
        ".s" => {
            if match_lines(&M68K_1, content)
                || match_lines(&M68K_2, content)
                || match_lines(&M68K_3, content)
                || match_lines(&M68K_4, content)
                || match_lines(&M68K_5, content)
                || match_lines(&M68K_6, content)
                || match_lines(&M68K_7, content)
            {
                Some("Motorola 68K Assembly")
            } else {
                Some("Unix Assembly")
            }
        }
        ".sc" => {
            if match_lines(&SUPERCOLLIDER_1, content) {
                Some("SuperCollider")
            } else if match_lines(&SCALA_1, content) {
                Some("Scala")
            } else {
                None
            }
        }
        ".scd" => {
            if match_lines(&SUPERCOLLIDER_1, content) {
                Some("SuperCollider")
            } else {
                Some("Markdown")
            }
        }
        ".sch" => {
            if match_lines(&EAGLE_1, content) {
                Some("Eagle")
            } else if match_lines(&XML_5, content) {
                Some("XML")
            } else if match_lines(&SCHEME_1, content) {
                Some("Scheme")
            } else {
                Some("KiCad Schematic")
            }
        }
        ".shader" => {
            if match_lines(&GLSL_1, content) {
                Some("GLSL")
            } else {
                Some("ShaderLab")
            }
        }
        ".sls" => {
            if match_lines(&SCHEME_1, content) {
                Some("Scheme")
            } else {
                Some("SaltStack")
            }
        }
        ".spec" => {
            if match_lines(&RPM_SPEC_1, content) {
                Some("RPM Spec")
            } else if match_lines(&PYTHON_SPEC_1, content)
                && match_lines(&PYTHON_SPEC_2, content)
                && match_lines(&PYTHON_SPEC_3, content)
                && match_lines(&PYTHON_SPEC_4, content)
            {
                Some("Python")
            } else {
                Some("Ruby")
            }
        }
        ".sol" => {
            if match_lines(&SOLIDITY_1, content) {
                Some("Solidity")
            } else if match_lines(&GERBER_IMAGE_1, content) {
                Some("Gerber Image")
            } else {
                None
            }
        }
        ".sql" => {
            if match_lines(&PLPGSQL_1, content) {
                Some("PLpgSQL")
            } else if match_lines(&SQLPL_1, content) {
                Some("SQLPL")
            } else if match_lines(&PLSQL_1, content) {
                Some("PLSQL")
            } else if match_lines(&TSQL_1, content) {
                Some("TSQL")
            } else {
                Some("SQL")
            }
        }
        ".srt" => {
            if match_lines(&SUBRIP_TEXT_1, content) {
                Some("SubRip Text")
            } else {
                Some("SRecode Template")
            }
        }
        ".st" => {
            if match_lines(&STRING_TEMPLATE, content) {
                Some("StringTemplate")
            } else if match_lines(&SMALLTALK_2, content) {
                Some("Smalltalk")
            } else {
                None
            }
        }
        ".t" => {
            if match_lines(&PERL5_1, content) {
                Some("Perl")
            } else if match_lines(&RAKU_1, content) {
                Some("Raku")
            } else if match_lines(&TURING_1, content) {
                Some("Turing")
            } else {
                Some("Terra")
            }
        }
        ".toc" => {
            if match_lines(&WORLD_OF_WARCRAFT_ADDON_DATA_1, content) {
                Some("World of Warcraft Addon Data")
            } else if match_lines(&TEX_2, content) {
                Some("TeX")
            } else {
                None
            }
        }
        ".ts" => {
            if match_lines(&XML_6, content) {
                Some("XML")
            } else {
                Some("TypeScript")
            }
        }
        ".tst" => {
            if match_lines(&GAP_2, content) {
                Some("GAP")
            } else {
                Some("Scilab")
            }
        }
        ".tsx" => {
            if match_lines(&TSX_1, content) {
                Some("TSX")
            } else if match_lines(&XML_7, content) {
                Some("XML")
            } else {
                None
            }
        }
        ".txt" => {
            if match_lines(&VIM_HELP_FILE_1, content) {
                Some("Vim Help File")
            } else {
                Some("Text")
            }
        }
        ".v" => {
            if match_lines(&COQ_1, content) {
                Some("Coq")
            } else if match_lines(&VERILOG_1, content) {
                Some("Verilog")
            } else if match_lines(&V_1, content) {
                Some("V")
            } else {
                None
            }
        }
        ".vba" => {
            if match_lines(&VIM_SCRIPT_1, content) {
                Some("Vim script")
            } else {
                Some("VBA")
            }
        }
        ".vhost" => {
            if match_lines(&APACHECONF_1, content) {
                Some("ApacheConf")
            } else {
                Some("Nginx")
            }
        }
        ".w" => {
            if match_lines(&OPENEDGE_ABL_1, content) {
                Some("OpenEdge ABL")
            } else if match_lines(&CWEB_1, content) {
                Some("CWeb")
            } else {
                None
            }
        }
        ".workflow" => {
            if match_lines(&XML_5, content) {
                Some("XML")
            } else {
                Some("HCL")
            }
        }
        ".x" => {
            if match_lines(&DIRECTX_3D_FILE_1, content) {
                Some("DirectX 3D File")
            } else if match_lines(&RPC_1, content) {
                Some("RPC")
            } else if match_lines(&LOGOS_1, content) {
                Some("Logos")
            } else if match_lines(&LINKER_SCRIPT_1, content) {
                Some("Linker Script")
            } else {
                None
            }
        }
        ".yy" => {
            if match_lines(&JSON_2, content) {
                Some("JSON")
            } else {
                Some("Yacc")
            }
        }
        ".bf" => {
            if match_lines(&BRAINFUCK_1, content) {
                Some("Brainfuck")
            } else if match_lines(&BEEF_1, content) {
                Some("Beef")
            } else {
                Some("HyPhy")
            }
        }
        ".b" => {
            if match_lines(&BRAINFUCK_1, content) {
                Some("Brainfuck")
            } else {
                Some("Limbo")
            }
        }
        _ => None,
    }
}
fn match_lines(regex: &Regex, lines: &[String]) -> bool {
    for line in lines {
        if regex.is_match(line).unwrap() {
            return true;
        }
    }
    false
}