github-linguist 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/linguist/blob_helper.rb +5 -0
- data/lib/linguist/heuristics.rb +13 -0
- data/lib/linguist/language.rb +16 -0
- data/lib/linguist/languages.yml +11 -0
- data/lib/linguist/samples.json +226 -8
- data/lib/linguist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ec2a6affd87821c6b5e7a2c5c8361b8e9eaac48
|
4
|
+
data.tar.gz: 5ae6ac96676621df9795f9820694c55c839a0bec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f9e2b765abdeb0a6e232c1b0b25c513ba32a2413381b55511a69c20a64ba716ca3fb13e75bfe3159b15d453bed1abb8c04af20e1d8c81fa843b69f69fb67742
|
7
|
+
data.tar.gz: 7399235cf6a420105c29b814075b8647a69c23f705247ff02939b45f84a7f7843aea90aeb3666640bfce228e02bd8da6283386efe1cad264f6180eae389c3965
|
data/lib/linguist/blob_helper.rb
CHANGED
@@ -321,6 +321,11 @@ module Linguist
|
|
321
321
|
language ? language.lexer : Pygments::Lexer.find_by_name('Text only')
|
322
322
|
end
|
323
323
|
|
324
|
+
# Internal: Get the TextMate compatible scope for the blob
|
325
|
+
def tm_scope
|
326
|
+
language && language.tm_scope
|
327
|
+
end
|
328
|
+
|
324
329
|
# Public: Highlight syntax of blob
|
325
330
|
#
|
326
331
|
# options - A Hash of options (defaults to {})
|
data/lib/linguist/heuristics.rb
CHANGED
@@ -19,6 +19,9 @@ module Linguist
|
|
19
19
|
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
20
20
|
result = disambiguate_ecl(data, languages)
|
21
21
|
end
|
22
|
+
if languages.all? { |l| ["IDL", "Prolog"].include?(l) }
|
23
|
+
result = disambiguate_pro(data, languages)
|
24
|
+
end
|
22
25
|
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
23
26
|
result = disambiguate_cl(data, languages)
|
24
27
|
end
|
@@ -51,6 +54,16 @@ module Linguist
|
|
51
54
|
matches
|
52
55
|
end
|
53
56
|
|
57
|
+
def self.disambiguate_pro(data, languages)
|
58
|
+
matches = []
|
59
|
+
if (data.include?(":-"))
|
60
|
+
matches << Language["Prolog"]
|
61
|
+
else
|
62
|
+
matches << Language["IDL"]
|
63
|
+
end
|
64
|
+
matches
|
65
|
+
end
|
66
|
+
|
54
67
|
def self.disambiguate_ts(data, languages)
|
55
68
|
matches = []
|
56
69
|
if (data.include?("</translation>"))
|
data/lib/linguist/language.rb
CHANGED
@@ -290,6 +290,16 @@ module Linguist
|
|
290
290
|
@lexer = Pygments::Lexer.find_by_name(attributes[:lexer] || name) ||
|
291
291
|
raise(ArgumentError, "#{@name} is missing lexer")
|
292
292
|
|
293
|
+
@tm_scope = attributes[:tm_scope] || begin
|
294
|
+
context = case @type
|
295
|
+
when :data, :markup, :prose
|
296
|
+
'text'
|
297
|
+
when :programming, nil
|
298
|
+
'source'
|
299
|
+
end
|
300
|
+
"#{context}.#{@name.downcase}"
|
301
|
+
end
|
302
|
+
|
293
303
|
@ace_mode = attributes[:ace_mode]
|
294
304
|
@wrap = attributes[:wrap] || false
|
295
305
|
|
@@ -363,6 +373,11 @@ module Linguist
|
|
363
373
|
# Returns the Lexer
|
364
374
|
attr_reader :lexer
|
365
375
|
|
376
|
+
# Public: Get the name of a TextMate-compatible scope
|
377
|
+
#
|
378
|
+
# Returns the scope
|
379
|
+
attr_reader :tm_scope
|
380
|
+
|
366
381
|
# Public: Get Ace mode
|
367
382
|
#
|
368
383
|
# Examples
|
@@ -564,6 +579,7 @@ module Linguist
|
|
564
579
|
:type => options['type'],
|
565
580
|
:aliases => options['aliases'],
|
566
581
|
:lexer => options['lexer'],
|
582
|
+
:tm_scope => options['tm_scope'],
|
567
583
|
:ace_mode => options['ace_mode'],
|
568
584
|
:wrap => options['wrap'],
|
569
585
|
:group_name => options['group'],
|
data/lib/linguist/languages.yml
CHANGED
@@ -83,6 +83,7 @@ ATS:
|
|
83
83
|
ActionScript:
|
84
84
|
type: programming
|
85
85
|
lexer: ActionScript 3
|
86
|
+
tm_scope: source.actionscript.3
|
86
87
|
color: "#e3491a"
|
87
88
|
search_term: as3
|
88
89
|
aliases:
|
@@ -282,6 +283,7 @@ C:
|
|
282
283
|
C#:
|
283
284
|
type: programming
|
284
285
|
ace_mode: csharp
|
286
|
+
tm_scope: source.cs
|
285
287
|
search_term: csharp
|
286
288
|
color: "#178600"
|
287
289
|
aliases:
|
@@ -411,6 +413,7 @@ Clojure:
|
|
411
413
|
|
412
414
|
CoffeeScript:
|
413
415
|
type: programming
|
416
|
+
tm_scope: source.coffee
|
414
417
|
ace_mode: coffee
|
415
418
|
color: "#244776"
|
416
419
|
aliases:
|
@@ -453,6 +456,7 @@ ColdFusion CFC:
|
|
453
456
|
|
454
457
|
Common Lisp:
|
455
458
|
type: programming
|
459
|
+
tm_scope: source.lisp
|
456
460
|
color: "#3fb68b"
|
457
461
|
aliases:
|
458
462
|
- lisp
|
@@ -648,6 +652,7 @@ Elm:
|
|
648
652
|
Emacs Lisp:
|
649
653
|
type: programming
|
650
654
|
lexer: Common Lisp
|
655
|
+
tm_scope: source.lisp
|
651
656
|
color: "#c065db"
|
652
657
|
aliases:
|
653
658
|
- elisp
|
@@ -932,6 +937,7 @@ Groovy Server Pages:
|
|
932
937
|
|
933
938
|
HTML:
|
934
939
|
type: markup
|
940
|
+
tm_scope: text.html.basic
|
935
941
|
ace_mode: html
|
936
942
|
aliases:
|
937
943
|
- xhtml
|
@@ -1158,6 +1164,7 @@ Java Server Pages:
|
|
1158
1164
|
|
1159
1165
|
JavaScript:
|
1160
1166
|
type: programming
|
1167
|
+
tm_scope: source.js
|
1161
1168
|
ace_mode: javascript
|
1162
1169
|
color: "#f1e05a"
|
1163
1170
|
aliases:
|
@@ -1569,6 +1576,7 @@ ObjDump:
|
|
1569
1576
|
|
1570
1577
|
Objective-C:
|
1571
1578
|
type: programming
|
1579
|
+
tm_scope: source.objc
|
1572
1580
|
color: "#438eff"
|
1573
1581
|
aliases:
|
1574
1582
|
- obj-c
|
@@ -1669,6 +1677,7 @@ PAWN:
|
|
1669
1677
|
|
1670
1678
|
PHP:
|
1671
1679
|
type: programming
|
1680
|
+
tm_scope: text.html.php
|
1672
1681
|
ace_mode: php
|
1673
1682
|
color: "#4F5D95"
|
1674
1683
|
extensions:
|
@@ -1820,6 +1829,7 @@ Prolog:
|
|
1820
1829
|
extensions:
|
1821
1830
|
- .pl
|
1822
1831
|
- .ecl
|
1832
|
+
- .pro
|
1823
1833
|
- .prolog
|
1824
1834
|
|
1825
1835
|
Propeller Spin:
|
@@ -2089,6 +2099,7 @@ SQF:
|
|
2089
2099
|
|
2090
2100
|
SQL:
|
2091
2101
|
type: data
|
2102
|
+
tm_scope: source.sql
|
2092
2103
|
ace_mode: sql
|
2093
2104
|
extensions:
|
2094
2105
|
- .sql
|
data/lib/linguist/samples.json
CHANGED
@@ -95,6 +95,10 @@
|
|
95
95
|
"Cirru": [
|
96
96
|
".cirru"
|
97
97
|
],
|
98
|
+
"Clean": [
|
99
|
+
".dcl",
|
100
|
+
".icl"
|
101
|
+
],
|
98
102
|
"Clojure": [
|
99
103
|
".cl2",
|
100
104
|
".clj",
|
@@ -871,8 +875,8 @@
|
|
871
875
|
"exception.zep.php"
|
872
876
|
]
|
873
877
|
},
|
874
|
-
"tokens_total":
|
875
|
-
"languages_total":
|
878
|
+
"tokens_total": 664804,
|
879
|
+
"languages_total": 936,
|
876
880
|
"tokens": {
|
877
881
|
"ABAP": {
|
878
882
|
"*/**": 1,
|
@@ -15573,20 +15577,19 @@
|
|
15573
15577
|
"backdrop.fade.in": 1
|
15574
15578
|
},
|
15575
15579
|
"Ceylon": {
|
15576
|
-
"doc": 2,
|
15577
15580
|
"by": 1,
|
15581
|
+
"(": 5,
|
15582
|
+
")": 5,
|
15578
15583
|
"shared": 5,
|
15579
15584
|
"void": 1,
|
15580
15585
|
"test": 1,
|
15581
|
-
"(": 4,
|
15582
|
-
")": 4,
|
15583
15586
|
"{": 3,
|
15584
15587
|
"print": 1,
|
15585
15588
|
";": 4,
|
15586
15589
|
"}": 3,
|
15587
15590
|
"class": 1,
|
15588
15591
|
"Test": 2,
|
15589
|
-
"name":
|
15592
|
+
"name": 3,
|
15590
15593
|
"satisfies": 1,
|
15591
15594
|
"Comparable": 1,
|
15592
15595
|
"<Test>": 1,
|
@@ -16429,6 +16432,219 @@
|
|
16429
16432
|
"nothing": 1,
|
16430
16433
|
"container": 3
|
16431
16434
|
},
|
16435
|
+
"Clean": {
|
16436
|
+
"module": 9,
|
16437
|
+
"fsieve": 1,
|
16438
|
+
"import": 10,
|
16439
|
+
"StdClass": 2,
|
16440
|
+
";": 1,
|
16441
|
+
"//": 4,
|
16442
|
+
"RWS": 1,
|
16443
|
+
"StdInt": 2,
|
16444
|
+
"StdReal": 1,
|
16445
|
+
"NrOfPrimes": 3,
|
16446
|
+
"The": 1,
|
16447
|
+
"sieve": 1,
|
16448
|
+
"algorithm": 1,
|
16449
|
+
"generate": 1,
|
16450
|
+
"an": 1,
|
16451
|
+
"infinite": 1,
|
16452
|
+
"list": 3,
|
16453
|
+
"of": 3,
|
16454
|
+
"all": 1,
|
16455
|
+
"primes.": 1,
|
16456
|
+
"Primes": 3,
|
16457
|
+
"[": 93,
|
16458
|
+
"Int": 33,
|
16459
|
+
"]": 92,
|
16460
|
+
"pr": 6,
|
16461
|
+
"where": 12,
|
16462
|
+
"Sieve": 8,
|
16463
|
+
"-": 66,
|
16464
|
+
"g": 10,
|
16465
|
+
"i": 14,
|
16466
|
+
"prs": 6,
|
16467
|
+
"|": 48,
|
16468
|
+
"IsPrime": 4,
|
16469
|
+
"(": 132,
|
16470
|
+
"toInt": 1,
|
16471
|
+
"sqrt": 1,
|
16472
|
+
"toReal": 1,
|
16473
|
+
")": 134,
|
16474
|
+
"+": 14,
|
16475
|
+
"Bool": 1,
|
16476
|
+
"f": 26,
|
16477
|
+
"r": 2,
|
16478
|
+
"bd": 3,
|
16479
|
+
"True": 1,
|
16480
|
+
"rem": 2,
|
16481
|
+
"False": 1,
|
16482
|
+
"Select": 2,
|
16483
|
+
"is": 1,
|
16484
|
+
"used": 1,
|
16485
|
+
"to": 2,
|
16486
|
+
"get": 1,
|
16487
|
+
"the": 3,
|
16488
|
+
"th": 1,
|
16489
|
+
"prime": 1,
|
16490
|
+
"from": 1,
|
16491
|
+
"primes": 1,
|
16492
|
+
"generated": 1,
|
16493
|
+
"by": 1,
|
16494
|
+
"Primes.": 1,
|
16495
|
+
"*/": 1,
|
16496
|
+
"Start": 3,
|
16497
|
+
"definition": 4,
|
16498
|
+
"GenHylo": 2,
|
16499
|
+
"StdGeneric": 4,
|
16500
|
+
"GenMap": 4,
|
16501
|
+
"Fix": 9,
|
16502
|
+
"In": 9,
|
16503
|
+
".": 6,
|
16504
|
+
"Out": 1,
|
16505
|
+
"u": 6,
|
16506
|
+
"v": 12,
|
16507
|
+
"a": 55,
|
16508
|
+
"w": 4,
|
16509
|
+
"<=>": 1,
|
16510
|
+
"hylo": 1,
|
16511
|
+
"b": 7,
|
16512
|
+
".b": 4,
|
16513
|
+
".a": 11,
|
16514
|
+
".f": 1,
|
16515
|
+
"gMap": 19,
|
16516
|
+
"{": 17,
|
16517
|
+
"*": 13,
|
16518
|
+
"}": 17,
|
16519
|
+
"cata": 4,
|
16520
|
+
"ana": 1,
|
16521
|
+
"generic": 2,
|
16522
|
+
"derive": 4,
|
16523
|
+
"c": 2,
|
16524
|
+
"UNIT": 2,
|
16525
|
+
"PAIR": 4,
|
16526
|
+
"EITHER": 3,
|
16527
|
+
"CONS": 4,
|
16528
|
+
"FIELD": 4,
|
16529
|
+
"OBJECT": 4,
|
16530
|
+
"implementation": 3,
|
16531
|
+
"StdArray": 1,
|
16532
|
+
"StdFunc": 1,
|
16533
|
+
"_Array": 1,
|
16534
|
+
"x": 36,
|
16535
|
+
"fx": 2,
|
16536
|
+
"fy": 2,
|
16537
|
+
"y": 11,
|
16538
|
+
"fl": 3,
|
16539
|
+
"fr": 3,
|
16540
|
+
"LEFT": 2,
|
16541
|
+
"RIGHT": 2,
|
16542
|
+
"xs": 4,
|
16543
|
+
"mapArray": 2,
|
16544
|
+
"monadicSemantics": 1,
|
16545
|
+
"StdEnv": 4,
|
16546
|
+
"Op": 6,
|
16547
|
+
"Plus": 2,
|
16548
|
+
"Minus": 2,
|
16549
|
+
"Times": 2,
|
16550
|
+
"Rem": 3,
|
16551
|
+
"Equal": 2,
|
16552
|
+
"LessThan": 3,
|
16553
|
+
"Var": 9,
|
16554
|
+
"String": 1,
|
16555
|
+
"ExpP": 3,
|
16556
|
+
"Exp": 5,
|
16557
|
+
"StmP": 3,
|
16558
|
+
"Assign": 3,
|
16559
|
+
"If": 3,
|
16560
|
+
"While": 3,
|
16561
|
+
"Seq": 3,
|
16562
|
+
"Cont": 4,
|
16563
|
+
"Stm": 2,
|
16564
|
+
"Env": 3,
|
16565
|
+
"Sem": 11,
|
16566
|
+
"empty": 2,
|
16567
|
+
"rtn": 4,
|
16568
|
+
"e.": 4,
|
16569
|
+
"e": 16,
|
16570
|
+
"infixl": 4,
|
16571
|
+
"e2": 2,
|
16572
|
+
".y": 1,
|
16573
|
+
"_.": 1,
|
16574
|
+
"read": 4,
|
16575
|
+
"write": 3,
|
16576
|
+
"w.": 1,
|
16577
|
+
"if": 5,
|
16578
|
+
"class": 1,
|
16579
|
+
"sem": 9,
|
16580
|
+
"operator": 8,
|
16581
|
+
"<": 3,
|
16582
|
+
"instance": 14,
|
16583
|
+
"phi": 12,
|
16584
|
+
"n": 8,
|
16585
|
+
"op": 5,
|
16586
|
+
"v1.": 1,
|
16587
|
+
"return": 1,
|
16588
|
+
"o": 6,
|
16589
|
+
"v1": 1,
|
16590
|
+
"s1": 4,
|
16591
|
+
"s2": 4,
|
16592
|
+
"stm": 2,
|
16593
|
+
"s": 49,
|
16594
|
+
"Here": 1,
|
16595
|
+
"*finally*": 1,
|
16596
|
+
"pays": 1,
|
16597
|
+
"off": 1,
|
16598
|
+
"D": 1,
|
16599
|
+
"int": 2,
|
16600
|
+
"var": 6,
|
16601
|
+
"o2": 7,
|
16602
|
+
"assign": 4,
|
16603
|
+
"ifte": 1,
|
16604
|
+
"while": 2,
|
16605
|
+
"seq": 3,
|
16606
|
+
"cont": 1,
|
16607
|
+
"pEuclides": 2,
|
16608
|
+
"fst": 1,
|
16609
|
+
"program": 2,
|
16610
|
+
"start": 4,
|
16611
|
+
"_": 5,
|
16612
|
+
"infixr": 1,
|
16613
|
+
"stack": 2,
|
16614
|
+
"Stack": 28,
|
16615
|
+
"newStack": 3,
|
16616
|
+
"push": 3,
|
16617
|
+
"pushes": 3,
|
16618
|
+
"pop": 4,
|
16619
|
+
"popn": 3,
|
16620
|
+
"top": 4,
|
16621
|
+
"topn": 3,
|
16622
|
+
"elements": 3,
|
16623
|
+
"count": 3,
|
16624
|
+
"abort": 2,
|
16625
|
+
"drop": 1,
|
16626
|
+
"take": 1,
|
16627
|
+
"length": 1,
|
16628
|
+
"streams": 2,
|
16629
|
+
"zero": 4,
|
16630
|
+
"Real": 28,
|
16631
|
+
"one": 5,
|
16632
|
+
"/": 3,
|
16633
|
+
"X": 3,
|
16634
|
+
"invert": 5,
|
16635
|
+
"pow": 5,
|
16636
|
+
"shuffle": 6,
|
16637
|
+
"//Infinite": 1,
|
16638
|
+
"row": 1,
|
16639
|
+
"zeroes": 1,
|
16640
|
+
"represented": 1,
|
16641
|
+
"as": 1,
|
16642
|
+
"ease": 1,
|
16643
|
+
"computation": 1,
|
16644
|
+
"t": 23,
|
16645
|
+
"/s": 2,
|
16646
|
+
"s*t": 1
|
16647
|
+
},
|
16432
16648
|
"Clojure": {
|
16433
16649
|
"(": 258,
|
16434
16650
|
"defn": 14,
|
@@ -73901,9 +74117,10 @@
|
|
73901
74117
|
"C++": 34739,
|
73902
74118
|
"COBOL": 90,
|
73903
74119
|
"CSS": 43867,
|
73904
|
-
"Ceylon":
|
74120
|
+
"Ceylon": 49,
|
73905
74121
|
"Chapel": 9607,
|
73906
74122
|
"Cirru": 244,
|
74123
|
+
"Clean": 1554,
|
73907
74124
|
"Clojure": 1899,
|
73908
74125
|
"CoffeeScript": 2951,
|
73909
74126
|
"ColdFusion": 131,
|
@@ -74124,6 +74341,7 @@
|
|
74124
74341
|
"Ceylon": 1,
|
74125
74342
|
"Chapel": 5,
|
74126
74343
|
"Cirru": 9,
|
74344
|
+
"Clean": 9,
|
74127
74345
|
"Clojure": 8,
|
74128
74346
|
"CoffeeScript": 9,
|
74129
74347
|
"ColdFusion": 1,
|
@@ -74316,5 +74534,5 @@
|
|
74316
74534
|
"fish": 3,
|
74317
74535
|
"wisp": 1
|
74318
74536
|
},
|
74319
|
-
"md5": "
|
74537
|
+
"md5": "9bf6bc418e6a2a8064041209da3a0ccd"
|
74320
74538
|
}
|
data/lib/linguist/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charlock_holmes
|