Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/samcv/linguist into master
Browse files Browse the repository at this point in the history
  • Loading branch information
samcv committed Apr 6, 2018
2 parents 34c623e + 56a44cb commit 130b7f7
Show file tree
Hide file tree
Showing 3 changed files with 762 additions and 6 deletions.
28 changes: 22 additions & 6 deletions lib/linguist/heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def call(data)
Language["ECL"]
end
end

disambiguate ".es" do |data|
if /^\s*(?:%%|main\s*\(.*?\)\s*->)/.match(data)
Language["Erlang"]
Expand Down Expand Up @@ -380,6 +380,22 @@ def call(data)
end
end

disambiguate ".pod" do |data|
if /^\s*=\w+$/.match(data)
if /^=pod|=cut/.match(data)
Language["Pod"]
elsif /^\s*=begin pod/.match(data)
Language["Perl 6"]
else
Language["Pod"]
end
elsif Perl6Regex.match(data)
Language["Perl 6"]
elsif /^\s*\/\* XPM \*\//.match(data)
Language["XPM"]
end
end

disambiguate ".pro" do |data|
if /^[^\[#]+:-/.match(data)
Language["Prolog"]
Expand Down Expand Up @@ -455,13 +471,13 @@ def call(data)
Language["SQL"]
end
end

disambiguate ".srt" do |data|
if /^(\d{2}:\d{2}:\d{2},\d{3})\s*(-->)\s*(\d{2}:\d{2}:\d{2},\d{3})$/.match(data)
Language["SubRip Text"]
end
end

disambiguate ".t" do |data|
if Perl5Regex.match(data)
Language["Perl"]
Expand All @@ -471,7 +487,7 @@ def call(data)
Language["Turing"]
end
end

disambiguate ".toc" do |data|
if /^## |@no-lib-strip@/.match(data)
Language["World of Warcraft Addon Data"]
Expand Down Expand Up @@ -504,15 +520,15 @@ def call(data)
Language["XML"]
end
end

disambiguate ".w" do |data|
if (data.include?("&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS"))
Language["OpenEdge ABL"]
elsif /^@(<|\w+\.)/.match(data)
Language["CWeb"]
end
end

disambiguate ".x" do |data|
if /\b(program|version)\s+\w+\s*{|\bunion\s+\w+\s+switch\s*\(/.match(data)
Language["RPC"]
Expand Down
2 changes: 2 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3401,6 +3401,8 @@ Perl 6:
- ".pl6"
- ".pm"
- ".pm6"
- ".pod"
- ".pod6"
- ".t"
filenames:
- Rexfile
Expand Down
Loading

0 comments on commit 130b7f7

Please sign in to comment.