mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Detect "use 5.xxx" as Perl
This commit is contained in:
@@ -92,7 +92,7 @@ module Linguist
|
|||||||
disambiguate "Perl", "Perl6", "Prolog" do |data|
|
disambiguate "Perl", "Perl6", "Prolog" do |data|
|
||||||
if data.include?("use v6")
|
if data.include?("use v6")
|
||||||
Language["Perl6"]
|
Language["Perl6"]
|
||||||
elsif data.include?("use strict")
|
elsif data.match(/use strict|use\s+v?5\./)
|
||||||
Language["Perl"]
|
Language["Perl"]
|
||||||
elsif data.include?(":-")
|
elsif data.include?(":-")
|
||||||
Language["Prolog"]
|
Language["Prolog"]
|
||||||
|
|||||||
3
samples/Perl/use5.pl
Normal file
3
samples/Perl/use5.pl
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
use Mojolicious::Lite;
|
||||||
|
use 5.20.0;
|
||||||
|
use experimental 'signatures';
|
||||||
@@ -48,7 +48,7 @@ class TestHeuristcs < Minitest::Test
|
|||||||
def test_pl_prolog_perl_by_heuristics
|
def test_pl_prolog_perl_by_heuristics
|
||||||
assert_heuristics({
|
assert_heuristics({
|
||||||
"Prolog" => "Prolog/turing.pl",
|
"Prolog" => "Prolog/turing.pl",
|
||||||
"Perl" => "Perl/perl-test.t",
|
"Perl" => ["Perl/perl-test.t", "Perl/use5.pl"]
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user