lib/linguist/heuristics.rb in github-linguist-4.5.4 vs lib/linguist/heuristics.rb in github-linguist-4.5.5
- old
+ new
@@ -127,11 +127,11 @@
Language["Scilab"]
end
end
disambiguate "Common Lisp", "OpenCL", "Cool" do |data|
- if data.include?("(defun ")
+ if /^\s*\((defun|in-package|defpackage) /i.match(data)
Language["Common Lisp"]
elsif /^class/x.match(data)
Language["Cool"]
elsif /\/\* |\/\/ |^\}/.match(data)
Language["OpenCL"]
@@ -153,16 +153,16 @@
Language["Scala"]
end
end
disambiguate "AsciiDoc", "AGS Script", "Public Key" do |data|
- if /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data)
+ if /^(----[- ]BEGIN|ssh-(rsa|dss)) /.match(data)
+ Language["Public Key"]
+ elsif /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data)
Language["AsciiDoc"]
elsif /^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])/.match(data)
Language["AGS Script"]
- elsif /^-----BEGIN/.match(data)
- Language["Public Key"]
end
end
disambiguate "FORTRAN", "Forth", "Formatted" do |data|
if /^: /.match(data)
@@ -182,11 +182,11 @@
elsif /#include|#pragma\s+(rs|version)|__attribute__/.match(data)
Language["Filterscript"]
end
end
- disambiguate "M", "MUF", "Mathematica", "Matlab", "Mercury", "Objective-C" do |data|
+ disambiguate "Limbo", "M", "MUF", "Mathematica", "Matlab", "Mercury", "Objective-C" do |data|
if ObjectiveCRegex.match(data)
Language["Objective-C"]
elsif data.include?(":- module")
Language["Mercury"]
elsif /^: /.match(data)
@@ -195,10 +195,12 @@
Language["M"]
elsif /^\s*\(\*/.match(data)
Language["Mathematica"]
elsif /^\s*%/.match(data)
Language["Matlab"]
+ elsif /^\w+\s*:\s*module\s*{/.match(data)
+ Language["Limbo"]
end
end
disambiguate "Gosu", "JavaScript" do |data|
Language["Gosu"] if /^uses java\./.match(data)
@@ -211,11 +213,11 @@
Language["LiveScript"]
end
end
disambiguate "Common Lisp", "NewLisp" do |data|
- if /^\s*\((defun|in-package|defpackage) /.match(data)
+ if /^\s*\((defun|in-package|defpackage) /i.match(data)
Language["Common Lisp"]
elsif /^\s*\(define /.match(data)
Language["NewLisp"]
end
end
@@ -263,18 +265,18 @@
Language["Makefile"]
end
end
disambiguate "OCaml", "Standard ML" do |data|
- if /module|let rec |match\s+(\S+\s)+with/.match(data)
+ if /(^\s*module)|let rec |match\s+(\S+\s)+with/.match(data)
Language["OCaml"]
elsif /=> |case\s+(\S+\s)+of/.match(data)
Language["Standard ML"]
end
end
disambiguate "NL", "NewLisp" do |data|
- if /^g3 /.match(data)
+ if /^(b|g)[0-9]+ /.match(data)
Language["NL"]
else
Language["NewLisp"]
end
end