mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Fix test for Perl heuristic
Improve heuristic rule for Perl6 Separate heuristic rules for .pl (with Prolog) and .pm (without Prolog)
This commit is contained in:
@@ -93,15 +93,23 @@ module Linguist
|
||||
end
|
||||
|
||||
disambiguate ".pl" do |data|
|
||||
if data.include?("use v6")
|
||||
if /^(use v6|(my )?class|module)/.match(data)
|
||||
Language["Perl6"]
|
||||
elsif data.match(/use strict|use\s+v?5\./)
|
||||
elsif /use strict|use\s+v?5\./.match(data)
|
||||
Language["Perl"]
|
||||
elsif /^[^#]+:-/.match(data)
|
||||
Language["Prolog"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate ".pm" do |data|
|
||||
if /^(use v6|(my )?class|module)/.match(data)
|
||||
Language["Perl6"]
|
||||
elsif /use strict|use\s+v?5\./.match(data)
|
||||
Language["Perl"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate ".ecl" do |data|
|
||||
if /^[^#]+:-/.match(data)
|
||||
Language["Prolog"]
|
||||
|
||||
Reference in New Issue
Block a user