mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Merge heuristics for disambiguating ".t" files (#3587)
References: github/linguist#3546
This commit is contained in:
committed by
Paul Chaignon
parent
4166f2e89d
commit
44f03e64c1
@@ -344,11 +344,11 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate ".pm", ".t" do |data|
|
||||
if /use strict|use\s+v?5\./.match(data)
|
||||
Language["Perl"]
|
||||
elsif /^(use v6|(my )?class|module)/.match(data)
|
||||
disambiguate ".pm" do |data|
|
||||
if /^\s*(?:use\s+v6\s*;|(?:\bmy\s+)?class|module)\b/.match(data)
|
||||
Language["Perl6"]
|
||||
elsif /\buse\s+(?:strict\b|v?5\.)/.match(data)
|
||||
Language["Perl"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -443,10 +443,12 @@ module Linguist
|
||||
end
|
||||
|
||||
disambiguate ".t" do |data|
|
||||
if /^\s*%|^\s*var\s+\w+\s*:\s*\w+/.match(data)
|
||||
if /^\s*%[ \t]+|^\s*var\s+\w+\s*:=\s*\w+/.match(data)
|
||||
Language["Turing"]
|
||||
elsif /^\s*use\s+v6\s*;/.match(data)
|
||||
elsif /^\s*(?:use\s+v6\s*;|\bmodule\b|\b(?:my\s+)?class\b)/.match(data)
|
||||
Language["Perl6"]
|
||||
elsif /\buse\s+(?:strict\b|v?5\.)/.match(data)
|
||||
Language["Perl"]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user