Skip to content

jfmc/prolog-syntax-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A test for Prolog syntax for github/linguist

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published