github-linguist 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/linguist/samples.json +4192 -5042
- data/lib/linguist/tokenizer.rb +5 -0
- metadata +2 -2
data/lib/linguist/tokenizer.rb
CHANGED
@@ -16,6 +16,9 @@ module Linguist
|
|
16
16
|
new.extract_tokens(data)
|
17
17
|
end
|
18
18
|
|
19
|
+
# Read up to 100KB
|
20
|
+
BYTE_LIMIT = 100_000
|
21
|
+
|
19
22
|
# Start state on token, ignore anything till the next newline
|
20
23
|
SINGLE_LINE_COMMENTS = [
|
21
24
|
'//', # C
|
@@ -55,6 +58,8 @@ module Linguist
|
|
55
58
|
|
56
59
|
tokens = []
|
57
60
|
until s.eos?
|
61
|
+
break if s.pos >= BYTE_LIMIT
|
62
|
+
|
58
63
|
if token = s.scan(/^#!.+$/)
|
59
64
|
if name = extract_shebang(token)
|
60
65
|
tokens << "SHEBANG#!#{name}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-linguist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: charlock_holmes
|