/prolog-syntax-test

A test for Prolog syntax for github/linguist

Primary LanguagePerl

A test for Prolog syntax

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: like test1.pl with some comments at the end
  • test3.pl: correct after github-linguist/linguist#3409
  • test4.pl: correct
  • test5.pl: like test1.pl with some text to trick linguist
  • test6.pl: like test2.pl with some text to trick linguist