From f9ad5dda568ba2f476008de6f8fb0ba25622e3d5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 10 Nov 2014 11:43:30 +0100 Subject: [PATCH] Add heuristic distinguishing GAP and Scilab .tst files --- lib/linguist/heuristics.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 53bb10a9..d6c097ce 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -40,6 +40,9 @@ module Linguist if languages.all? { |l| ["FORTRAN", "Forth"].include?(l) } result = disambiguate_f(data) end + if name.end_with? ".tst" and languages.all? { |l| ["GAP", "Scilab"].include?(l) } + result = disambiguate_tst(data) + end return result end end @@ -98,6 +101,16 @@ module Linguist matches end + def self.disambiguate_tst(data) + matches = [] + if (data.include?("gap> ")) + matches << Language["GAP"] + else + matches << Language["Scilab"] + end + matches + end + def self.disambiguate_cl(data) matches = [] if data.include?("(defun ")