This repository contains some Prolog code that is incorrectly classified by github/linguist as Perl. The current heuristic is based on:
disambiguate ".pl" do |data|
if /^[^#]*:-/.match(data)
Language["Prolog"]
elsif /use strict|use\s+v?5\./.match(data)
Language["Perl"]
elsif /^(use v6|(my )?class|module)/.match(data)
Language["Perl6"]
end
end
A better heuristic may be looking at a period at the end of the file .
,
after ignoring blanks and comments:
- all Prolog sentences end in a period
- this is not valid Perl syntax (AFAIK)
Description:
test1.pl
: simplest Prolog file (with a clause)test2.pl
: liketest1.pl
with some comments at the endtest3.pl
: correct after github-linguist/linguist#3409test4.pl
: correcttest5.pl
: liketest1.pl
with some text to tricklinguist
test6.pl
: liketest2.pl
with some text to tricklinguist