github-linguist 4.8.12 → 4.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/grammars/source.viml.json +1043 -126
- data/lib/linguist/heuristics.rb +1 -1
- data/lib/linguist/language.rb +13 -0
- data/lib/linguist/languages.json +1 -1
- data/lib/linguist/languages.yml +199 -3
- data/lib/linguist/samples.json +14 -6
- data/lib/linguist/strategy/modeline.rb +89 -10
- data/lib/linguist/version.rb +1 -1
- metadata +2 -2
data/lib/linguist/samples.json
CHANGED
@@ -1582,8 +1582,8 @@
|
|
1582
1582
|
".gemrc"
|
1583
1583
|
]
|
1584
1584
|
},
|
1585
|
-
"tokens_total":
|
1586
|
-
"languages_total":
|
1585
|
+
"tokens_total": 1193520,
|
1586
|
+
"languages_total": 1658,
|
1587
1587
|
"tokens": {
|
1588
1588
|
"1C Enterprise": {
|
1589
1589
|
"&": 8,
|
@@ -31549,12 +31549,20 @@
|
|
31549
31549
|
"hit": 2
|
31550
31550
|
},
|
31551
31551
|
"FORTRAN": {
|
31552
|
+
"Codes/HYCOM/hycom/ATLb2.00/src_2.0.01_22_one/": 1,
|
31553
|
+
"real": 1,
|
31554
|
+
"onemu": 1,
|
31555
|
+
"twomu": 1,
|
31556
|
+
"data": 3,
|
31557
|
+
"onemu/0.0098/": 1,
|
31558
|
+
"twomu/1./": 1,
|
31559
|
+
"threemu/0.e9/": 1,
|
31560
|
+
"end": 13,
|
31552
31561
|
"c": 3,
|
31553
31562
|
"comment": 8,
|
31554
31563
|
"*": 4,
|
31555
31564
|
"program": 3,
|
31556
31565
|
"main": 3,
|
31557
|
-
"end": 12,
|
31558
31566
|
"subroutine": 3,
|
31559
31567
|
"foo": 4,
|
31560
31568
|
"(": 20,
|
@@ -134154,7 +134162,7 @@
|
|
134154
134162
|
"Erlang": 7011,
|
134155
134163
|
"F#": 3281,
|
134156
134164
|
"FLUX": 1392,
|
134157
|
-
"FORTRAN":
|
134165
|
+
"FORTRAN": 203,
|
134158
134166
|
"Filebench WML": 109,
|
134159
134167
|
"Filterscript": 143,
|
134160
134168
|
"Formatted": 5103,
|
@@ -134506,7 +134514,7 @@
|
|
134506
134514
|
"Erlang": 13,
|
134507
134515
|
"F#": 8,
|
134508
134516
|
"FLUX": 4,
|
134509
|
-
"FORTRAN":
|
134517
|
+
"FORTRAN": 5,
|
134510
134518
|
"Filebench WML": 1,
|
134511
134519
|
"Filterscript": 2,
|
134512
134520
|
"Formatted": 3,
|
@@ -134774,5 +134782,5 @@
|
|
134774
134782
|
"wisp": 1,
|
134775
134783
|
"xBase": 3
|
134776
134784
|
},
|
134777
|
-
"md5": "
|
134785
|
+
"md5": "622861cd377294bbe0f2ed68f111588a"
|
134778
134786
|
}
|
@@ -1,19 +1,98 @@
|
|
1
1
|
module Linguist
|
2
2
|
module Strategy
|
3
3
|
class Modeline
|
4
|
-
EMACS_MODELINE =
|
4
|
+
EMACS_MODELINE = /
|
5
|
+
-\*-
|
6
|
+
(?:
|
7
|
+
# Short form: `-*- ruby -*-`
|
8
|
+
\s* (?= [^:;\s]+ \s* -\*-)
|
9
|
+
|
|
10
|
+
# Longer form: `-*- foo:bar; mode: ruby; -*-`
|
11
|
+
(?:
|
12
|
+
.*? # Preceding variables: `-*- foo:bar bar:baz;`
|
13
|
+
[;\s] # Which are delimited by spaces or semicolons
|
14
|
+
|
|
15
|
+
(?<=-\*-) # Not preceded by anything: `-*-mode:ruby-*-`
|
16
|
+
)
|
17
|
+
mode # Major mode indicator
|
18
|
+
\s*:\s* # Allow whitespace around colon: `mode : ruby`
|
19
|
+
)
|
20
|
+
([^:;\s]+) # Name of mode
|
5
21
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
22
|
+
# Ensure the mode is terminated correctly
|
23
|
+
(?=
|
24
|
+
# Followed by semicolon or whitespace
|
25
|
+
[\s;]
|
26
|
+
|
|
27
|
+
# Touching the ending sequence: `ruby-*-`
|
28
|
+
(?<![-*]) # Don't allow stuff like `ruby--*-` to match; it'll invalidate the mode
|
29
|
+
-\*- # Emacs has no problems reading `ruby --*-`, however.
|
30
|
+
)
|
31
|
+
.*? # Anything between a cleanly-terminated mode and the ending -*-
|
32
|
+
-\*-
|
33
|
+
/xi
|
10
34
|
|
11
|
-
|
12
|
-
# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
|
13
|
-
# ex: 'vim set syntax=ruby:'
|
14
|
-
VIM_MODELINE_2 = /(?:vim|vi|Vim|ex):\s*se(?:t)?.*\s(?:ft|filetype|syntax)=(\w+)\s?.*:/i
|
35
|
+
VIM_MODELINE = /
|
15
36
|
|
16
|
-
|
37
|
+
# Start modeline. Could be `vim:`, `vi:` or `ex:`
|
38
|
+
(?:
|
39
|
+
(?:\s|^)
|
40
|
+
vi
|
41
|
+
(?:m[<=>]?\d+|m)? # Version-specific modeline
|
42
|
+
|
|
43
|
+
[\t\x20] # `ex:` requires whitespace, because "ex:" might be short for "example:"
|
44
|
+
ex
|
45
|
+
)
|
46
|
+
|
47
|
+
# If the option-list begins with `set ` or `se `, it indicates an alternative
|
48
|
+
# modeline syntax partly-compatible with older versions of Vi. Here, the colon
|
49
|
+
# serves as a terminator for an option sequence, delimited by whitespace.
|
50
|
+
(?=
|
51
|
+
# So we have to ensure the modeline ends with a colon
|
52
|
+
: (?=\s* set? \s [^\n:]+ :) |
|
53
|
+
|
54
|
+
# Otherwise, it isn't valid syntax and should be ignored
|
55
|
+
: (?!\s* set? \s)
|
56
|
+
)
|
57
|
+
|
58
|
+
# Possible (unrelated) `option=value` pairs to skip past
|
59
|
+
(?:
|
60
|
+
# Option separator. Vim uses whitespace or colons to separate options (except if
|
61
|
+
# the alternate "vim: set " form is used, where only whitespace is used)
|
62
|
+
(?:
|
63
|
+
\s
|
64
|
+
|
|
65
|
+
\s* : \s* # Note that whitespace around colons is accepted too:
|
66
|
+
) # vim: noai : ft=ruby:noexpandtab
|
67
|
+
|
68
|
+
# Option's name. All recognised Vim options have an alphanumeric form.
|
69
|
+
\w*
|
70
|
+
|
71
|
+
# Possible value. Not every option takes an argument.
|
72
|
+
(?:
|
73
|
+
# Whitespace between name and value is allowed: `vim: ft =ruby`
|
74
|
+
\s*=
|
75
|
+
|
76
|
+
# Option's value. Might be blank; `vim: ft= ` says "use no filetype".
|
77
|
+
(?:
|
78
|
+
[^\\\s] # Beware of escaped characters: titlestring=\ ft=ruby
|
79
|
+
| # will be read by Vim as { titlestring: " ft=ruby" }.
|
80
|
+
\\.
|
81
|
+
)*
|
82
|
+
)?
|
83
|
+
)*
|
84
|
+
|
85
|
+
# The actual filetype declaration
|
86
|
+
[\s:] (?:filetype|ft|syntax) \s*=
|
87
|
+
|
88
|
+
# Language's name
|
89
|
+
(\w+)
|
90
|
+
|
91
|
+
# Ensure it's followed by a legal separator
|
92
|
+
(?=\s|:|$)
|
93
|
+
/xi
|
94
|
+
|
95
|
+
MODELINES = [EMACS_MODELINE, VIM_MODELINE]
|
17
96
|
|
18
97
|
# Scope of the search for modelines
|
19
98
|
# Number of lines to check at the beginning and at the end of the file
|
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: 4.8.
|
4
|
+
version: 4.8.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charlock_holmes
|